# main.py
from fastapi import FastAPI
from routes.tasks import tasks_route
app = FastAPI()
app.include_router(tasks_route)
-------------------------
# routes > tasks.py
from fastapi import APIRouter
tasks_route = APIRouter()
@tasks_route.get('/tasks')
def get_tasks():
return {'tasks': []}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter