init
This commit is contained in:
commit
3299d3cc4c
14 changed files with 3920 additions and 0 deletions
29
README.md
Normal file
29
README.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
# Based
|
||||
Based is a micro framework providing web dev primitives.
|
||||
|
||||
## Features
|
||||
- User Auth
|
||||
- PostgresDB Connection
|
||||
- Logging
|
||||
- Request Contexts
|
||||
- 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)
|
||||
);
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue