user update
This commit is contained in:
parent
d7a55f6579
commit
e5fe40e4be
8 changed files with 205 additions and 77 deletions
19
README.md
19
README.md
|
@ -9,24 +9,7 @@ Based is a micro framework providing web dev primitives.
|
|||
- Templates (Shell)
|
||||
|
||||
## User Auth
|
||||
To use the user auth feature, make sure a migration has added the following to your PostgresDB:
|
||||
|
||||
```sql
|
||||
CREATE TYPE user_role AS ENUM ('regular', 'admin');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
username VARCHAR(255) NOT NULL PRIMARY KEY,
|
||||
"password" text NOT NULL,
|
||||
user_role user_role NOT NULL DEFAULT 'regular'
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_session (
|
||||
id UUID NOT NULL PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
token text NOT NULL,
|
||||
"user" varchar(255) NOT NULL,
|
||||
FOREIGN KEY("user") REFERENCES users(username)
|
||||
);
|
||||
```
|
||||
To use the user auth feature, make sure a migration has added [these tables](src/auth/auth.sql) to your PostgresDB:
|
||||
|
||||
## 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`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue