based/README.md

29 lines
695 B
Markdown
Raw Normal View History

2024-12-17 23:28:43 +01:00
# Based
Based is a micro framework providing web dev primitives.
## Features
- User Auth
- PostgresDB Connection
- Logging
- Request Contexts
- Templates (Shell)
## User Auth
2024-12-27 03:56:27 +01:00
To use the user auth feature, make sure a migration has added [these tables](src/auth/auth.sql) to your PostgresDB:
2024-12-22 18:37:45 +01:00
## HTMX
Based has a route for serving HTMX at `based::htmx::htmx_script_route` which you can include in your rocket `routes!`. The HTMX script will be available at `/assets/htmx.min.js`.
Additionally you can check if a requests originates from HTMX:
```rs
#[get("/")]
pub async fn index(ctx: RequestContext) -> StringRespopnse {
if ctx.is_htmx {
...
} else {
...
}
}
```