-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
As a backend service
I want to provide a registration endpoint
So that new users can create accounts
Endpoint: POST /api/auth/register
Request Body:
{
"email": "user@example.com",
"password": "SecurePass123!"
}Responsibilities:
- Validate email format and uniqueness
- Validate password strength (min 8 chars, at least 1 uppercase, 1 lowercase, 1 number)
- Hash password using bcrypt
- Create user document in MongoDB
- Generate JWT token with user ID and email
- Return token and user data (excluding password)
Response:
{
"success": true,
"token": "jwt_token_here",
"user": {
"id": "user_id",
"email": "user@example.com",
"createdAt": "2024-01-01T00:00:00Z"
}
}Error Handling:
- 400: Invalid email/password format
- 409: Email already exists
- 500: Server error
Reactions are currently unavailable