Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
20 lines (16 loc) · 691 Bytes

File metadata and controls

20 lines (16 loc) · 691 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""
USAGE - This code is a simple example of how to create an API using FastAPI.
It creates an instance of the FastAPI class and defines two endpoints.
The first endpoint is a GET request to the root path, which returns a
JSON object with a "Data" key and a value of "Test". The second endpoint is a
GET request to the "/about" path, which returns a JSON object with a "Data" key
and a value of "About_endpoint_data".
"""
from fastapi import FastAPI
app = FastAPI() # Creates api object
@app.get("/") #This in an "endpoint"
def home():
return {"Data": "Test"}
@app.get("/about")
def about():
return {"Data", "About_endpoint_data"}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.