diff --git a/README.md b/README.md index 7e0b585..5cc6ec8 100644 --- a/README.md +++ b/README.md @@ -126,9 +126,10 @@ from ohmyapi.db.exceptions import DoesNotExist from .models import Tournament -# If .routes.router exists and is an APIRouter, OhMyAPI will -# automatically pick it up and add it to the app's main APIRouter. -router = APIRouter(prefix="/tournament") +# Expose your app's routes via `router = fastapi.APIRouter`. +# Use prefixes wisely to avoid cross-app namespace-collisions. +# Tags improve the UX of the OpenAPI docs at /docs. +router = APIRouter(prefix="/tournament", tags=['Tournament']) @router.get("/") diff --git a/src/ohmyapi/core/templates/app/routes.py.j2 b/src/ohmyapi/core/templates/app/routes.py.j2 index d6651bb..1e4d792 100644 --- a/src/ohmyapi/core/templates/app/routes.py.j2 +++ b/src/ohmyapi/core/templates/app/routes.py.j2 @@ -1,11 +1,15 @@ from ohmyapi.router import APIRouter + from . import models -router = APIRouter(prefix="/{{ app_name }}") +# Expose your app's routes via `router = fastapi.APIRouter`. +# Use prefixes wisely to avoid cross-app namespace-collisions. +# Tags improve the UX of the OpenAPI docs at /docs. +router = APIRouter(prefix="/{{ app_name }}", tags=[{{ app_name }}]) @router.get("/") -def ping(): +def hello_world(): return { "project": "{{ project_name }}", "app": "{{ app_name }}",