Skip to content

Authentication

Register

POST /api/auth/register

Body:

json
{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "password123"
}

Response:

json
{
  "token": "eyJhbGciOiJIUzI1NiJ9...",
  "user": {
    "id": "507f1f77bcf86cd799439011",
    "name": "John Doe",
    "email": "john@example.com"
  }
}

Login

POST /api/auth/login

Body:

json
{
  "email": "john@example.com",
  "password": "password123"
}

Response: Same format as register.

Get Profile

GET /api/auth/profile
Authorization: Bearer <token>

Response:

json
{
  "id": "507f1f77bcf86cd799439011",
  "name": "John Doe",
  "email": "john@example.com"
}

Update Profile

PATCH /api/auth/profile
Authorization: Bearer <token>

Body:

json
{
  "name": "Jane Doe"
}

Released under the MIT License.