Skip to content

Routeur Fast API

This content is not available in your language yet.

Configurer un routeur

Modifier le fichier main.py

main.py
from fastapi import FastAPI
from backend.router import router
app = FastAPI()
app.include_router(router)

Créer le fichier router.py

router.py
from fastapi import APIRouter
router = APIRouter()
@router.get('/')
def hello():
"""Hello world route to make sure the app is working correctly"""
return {"msg": "Hello World!"}