feat: add authentication routes, update environment variables, and enhance error handling

This commit is contained in:
2025-12-07 13:47:00 +00:00
parent 08aefd7cbe
commit df2b9e56b4
9 changed files with 261 additions and 4 deletions

View File

@@ -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>
```