update + htmx
This commit is contained in:
parent
40d69b61e1
commit
291949b8c6
8 changed files with 277 additions and 10 deletions
16
README.md
16
README.md
|
@ -27,3 +27,19 @@ CREATE TABLE IF NOT EXISTS user_session (
|
|||
FOREIGN KEY("user") REFERENCES users(username)
|
||||
);
|
||||
```
|
||||
|
||||
## 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 {
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue