-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
35 lines (24 loc) · 744 Bytes
/
app.py
File metadata and controls
35 lines (24 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import uvicorn
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
@app.get("/hello/{name}")
async def say_hello(name: str):
return {"message": f"Hello {name}"}
@app.get("/world/{name}")
async def say_world(name: str):
return {"message": f"World {name}"}
@app.get("/helloworld/{name}")
async def say_helloworld(name: str):
return {"message": f"helloworld {name}"}
@app.get("/a/{name}")
async def say_a(name: str):
return {"message": f"a {name}"}
@app.get("/b/{name}")
async def say_b(name: str):
return {"message": f"b {name}"}
if __name__ == "__main__":
print("111111111111111111111111111111111")
uvicorn.run(app, host="127.0.0.1", port=8000)