Created
October 28, 2020 06:40
-
-
Save betterdatascience/9fdb284c1db8020c2aa8a0d8f7bf490f to your computer and use it in GitHub Desktop.
002_fastapi
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
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