curl --request POST \
--url https://api.example.com/api/users/login \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"password": "<string>"
}
'{
"message": "<string>",
"token": "<string>",
"userId": 123,
"username": "<string>",
"error": "<string>"
}Authenticate a user and receive a JWT token
curl --request POST \
--url https://api.example.com/api/users/login \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"password": "<string>"
}
'{
"message": "<string>",
"token": "<string>",
"userId": 123,
"username": "<string>",
"error": "<string>"
}POST /api/users/login
curl -X POST https://api.mediguide.com/api/users/login \
-H "Content-Type: application/json" \
-d '{
"username": "johndoe",
"password": "securePassword123"
}'
{
"message": "Inicio de sesión exitoso",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"userId": 42,
"username": "johndoe"
}
{
"error": "Usuario y contraseña requeridos"
}
{
"error": "Usuario o contraseña incorrectos"
}
{
"error": "Error interno del servidor"
}
src/routes/users.js:51