Skip to content

Instantly share code, notes, and snippets.

@betterdatascience
Created October 28, 2020 06:40
Show Gist options
  • Save betterdatascience/9fdb284c1db8020c2aa8a0d8f7bf490f to your computer and use it in GitHub Desktop.
Save betterdatascience/9fdb284c1db8020c2aa8a0d8f7bf490f to your computer and use it in GitHub Desktop.
002_fastapi
import uvicorn
from fastapi import FastAPI
app = FastAPI()
@app.get('/')
def index():
'''
This is a first docstring.
'''
return {'message': 'Hello, stranger'}
@app.get('/{name}')
def get_name(name: str):
'''
This is a second docstring.
'''
return {'message': f'Hello, {name}'}
if __name__ == '__main__':
uvicorn.run(app, host='127.0.0.1', port=8000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment