Skip to content

Instantly share code, notes, and snippets.

@MwinyiMoha
Last active October 30, 2020 09:32
Show Gist options
  • Save MwinyiMoha/7ebdf571e1569186a04bef78f20c7e6c to your computer and use it in GitHub Desktop.
Save MwinyiMoha/7ebdf571e1569186a04bef78f20c7e6c to your computer and use it in GitHub Desktop.
from fastapi import FastAPI
from .api.endpoints import router as todo_router
from .database.utils import connect_mongo, disconnect_mongo
app = FastAPI(title='Todos API')
app.add_event_handler('startup', connect_mongo)
app.add_event_handler('shutdown', disconnect_mongo)
app.include_router(todo_router, prefix='/todos')
@app.get('/')
def index():
return {"Hola": "Mundo"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment