Skip to content

Instantly share code, notes, and snippets.

@SidJain1412
Last active May 12, 2023 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SidJain1412/38554db19f4fa8e713b25c4fb0a7ebd3 to your computer and use it in GitHub Desktop.
Save SidJain1412/38554db19f4fa8e713b25c4fb0a7ebd3 to your computer and use it in GitHub Desktop.
Basic FastAPI app
# 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