Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs on routing #729

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/routing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
## Routing in Frontik applications

On application start, frontik import all modules from {app_module}.pages so that any controller should be located there.
We use fastapi routing, read [these docs](https://fastapi.tiangolo.com/reference/apirouter/?h=apirouter) for details. A small important difference - you must inherit `frontik.routing.FastAPIRouter` instead `fastapi.APIRouter`. And use `from frontik.routing import router`, if you need default router.
We use fastapi routing, read [these docs](https://fastapi.tiangolo.com/reference/apirouter/?h=apirouter) for details.

> [!IMPORTANT]
> Never use `fastapi.APIRouter` router directly, instead you should import wrapped alternative from [`frontik.routing.FastAPIRouter`](https://github.com/hhru/frontik/blob/526a4cc22d151694fa48439f884dd03a6ca2329f/frontik/routing.py#L110)
>
> In any case you need the default FastAPI router — use `from frontik.routing import router`

example:

Expand Down
Loading