Last active
October 19, 2022 08:21
-
-
Save vndee/82c1d2b7df6471a0f53abcbd0262890a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI, Response | |
from fastapi.responses import JSONResponse | |
app = FastAPI(title="Demo REST Server") | |
@app.get("/hello") | |
async def hello() -> Response: | |
return JSONResponse({"message": "Hello, World"}) | |
@app.get("/get_user/{user_id}") | |
async def get_user(user_id: int) -> Response: | |
return JSONResponse({"message": f"You requested data of {user_id}"}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment