Skip to content

Commit

Permalink
HH-228148 emphasize on using wrapped router instead the fastapi one
Browse files Browse the repository at this point in the history
  • Loading branch information
sintell committed Aug 29, 2024
1 parent 526a4cc commit fd2384a
Showing 1 changed file with 6 additions and 1 deletion.
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 inherit from the `fastapi.APIRouter` router directly, instead you should use wrapped alternative from [`frontik.routing.FastAPIRouter`](https://github.com/hhru/frontik/blob/526a4cc22d151694fa48439f884dd03a6ca2329f/frontik/routing.py#L110)
>
> If you won't customize router behaviour then simply import `from frontik.routing import router`
example:

Expand Down

0 comments on commit fd2384a

Please sign in to comment.