URL: /api/user/register
Method: POST
Body:
{
"email": "string",
"username": "string",
"password": "string",
"roleId": "number" (optional; 1 for Admin, 2 for User)
}
Responses:
{
"message": "User created successfully",
"data": {
"id": "string",
"email": "string",
"username": "string",
"roleId": "number"
},
"token": "string"
}
{
"message": "User with this email already exists"
}
{
"message": "Internal server error"
}
URL: /api/user/login
Method: POST
Body:
{
"email": "string",
"password": "string"
}
Responses:
{
"message": "User logged in successfully",
"data": {
"id": "string",
"email": "string",
"username": "string"
},
"token": "string"
}
{
"message": "Invalid email or password"
}
{
"message": "Internal server error"
}