Last active
May 12, 2023 09:52
-
-
Save SidJain1412/38554db19f4fa8e713b25c4fb0a7ebd3 to your computer and use it in GitHub Desktop.
Basic FastAPI app
This file contains 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
# Run using `uvicorn simple_app:app --reload` | |
# Visit 127.0.0.1:8000/docs for documentation and testing the API | |
from fastapi import FastAPI, Query | |
app = FastAPI( | |
title="FastAPI Example", | |
description="### Hello world", | |
version=1.0, | |
) | |
@app.get("/echo/", tags=["APIs"], response_model=str) | |
def echo(input_value: str = Query(..., max_length=20)): | |
return input_value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment