Skip to content

Commit

Permalink
fix documentation wording
Browse files Browse the repository at this point in the history
Signed-off-by: ngn <[email protected]>
  • Loading branch information
ngn13 committed Jan 15, 2025
1 parent fdd394d commit c3d8b64
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,26 @@ MIDDLEWARE_OPTIONS(app, "/", options_index_mid);

### Set static directory
To setup a static route you can use the `ctorm_app_static` function,
**please note that ctorm only supports a single static route.**
**please note that ctorm only supports a single static route**.
```c
// static files be served at '/static' path,
// from the './files' directory
ctorm_app_static(app, "/static", "./files");
```
### Setup 404 (all) route
By default, routes that does not match with any other will be redirected
to a 404 page, you set a custom route for this:
By default, requests that does not match with any route will receive a 404 page.
You can change this behavior by creating a custom handler for these requests:
```c
ctorm_app_all(app, all_route);
```
This handler needs to follow the same route handler structure.

### Global locals
If you want to pass a variable to all the routes and middlewares, you can use global
locals:
```c
ctorm_app_local(app, "config", &config);
```
To access the local from the route or the middleware handler, you can use `REQ_LOCAL` or
To access the local from a route or the middleware handler, you can use `REQ_LOCAL` or
`ctorm_req_local`. See the [request documentation](req.md) for more information.

0 comments on commit c3d8b64

Please sign in to comment.