feat: add authentication routes, update environment variables, and enhance error handling
This commit is contained in:
@@ -18,6 +18,9 @@ Set:
|
||||
|
||||
```bash
|
||||
DATABASE_URL=postgres://username:password@localhost:5432/database_name
|
||||
JWT_SECRET=replace_with_a_long_random_secret
|
||||
JWT_EXPIRES_IN=7d
|
||||
PORT=3000
|
||||
```
|
||||
|
||||
## Run app
|
||||
@@ -45,3 +48,33 @@ Open Drizzle Studio:
|
||||
```bash
|
||||
bun run db:studio
|
||||
```
|
||||
|
||||
## Auth API
|
||||
|
||||
Register:
|
||||
|
||||
```bash
|
||||
POST /auth/register
|
||||
{
|
||||
"email": "user@example.com",
|
||||
"password": "password123",
|
||||
"name": "User Name"
|
||||
}
|
||||
```
|
||||
|
||||
Login:
|
||||
|
||||
```bash
|
||||
POST /auth/login
|
||||
{
|
||||
"email": "user@example.com",
|
||||
"password": "password123"
|
||||
}
|
||||
```
|
||||
|
||||
Get current user:
|
||||
|
||||
```bash
|
||||
GET /auth/me
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user