-
Notifications
You must be signed in to change notification settings - Fork 0
Users_post
Luigi Minardi edited this page Mar 1, 2022
·
1 revision
Create a new user on the database.
{
"name": "Adult",
"age": 20,
"surname": "User",
"nickname": "adult",
"email": "adult@gmail.com",
"password": "1234",
"isAdmin": true
}
{
"msg": "Adult, welcome!"
}
{
"age": 7,
"surname": "User",
"name": "Underage",
"email": "kid@gmail.com",
"password": "1234",
"nickname": "kid"
}
{
"msg": "Underage, welcome!"
}
Searching a user on the database by its email.
This endpoint need login.
If you're using postman or insomnia to check the API remember to put the token of the logged user on the
header
, asAuthorization: Bearer <token>
.
{
"email": "adult@gmail.com"
}
{
"id": 1,
"name": "Adult",
"age": 20,
"surname": "User",
"email": "adult@gmail.com",
"nickname": "adult",
"password": "$2b$10$ehA1HQZhz4k6cls.7iUb4.fzCPbGiD37/CPtPmKPTNDejcuWuXNXq",
"isAdmin": true,
"createdAt": "2022-02-26T20:12:57.000Z",
"updatedAt": "2022-02-26T20:14:11.000Z"
}
Do the login of a user registered before on the api.
{
"email": "adult@gmail.com",
"password": "1234"
}
{
"user": {
"id": 1,
"name": "Adult",
"age": 20,
"surname": "User",
"email": "adult@gmail.com",
"nickname": "adult",
"password": "$2b$10$ehA1HQZhz4k6cls.7iUb4.fzCPbGiD37/CPtPmKPTNDejcuWuXNXq",
"isAdmin": true,
"createdAt": "2022-02-26T20:12:57.000Z",
"updatedAt": "2022-02-26T20:14:11.000Z"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoxLCJuYW1lIjoiSmFpciIsImFnZSI6MTksInN1cm5hbWUiOiJEYSBTaWx2YSIsImVtYWlsIjoiamF6YW9AZ21haWwuY29tIiwibmlja25hbWUiOiJKYXppciIsInBhc3N3b3JkIjoiJDJiJDEwJGVoQTFIUVpoejRrNmNscy43aVViNC5mekNQYkdpRDM3L0NQdFBtS1BUTkRlamN1V3VYTlhxIiwiaXNBZG1pbiI6dHJ1ZSwiY3JlYXRlZEF0IjoiMjAyMi0wMi0yNlQyMDoxMjo1Ny4wMDBaIiwidXBkYXRlZEF0IjoiMjAyMi0wMi0yNlQyMDoxNDoxMS4wMDBaIn0sImlhdCI6MTY0NTk3ODU1MSwiZXhwIjoxNjQ2MDY0OTUxfQ.gA1vouJPUbDWQYPRRKYwdQRoN4_-f0Adx1oVrVefJy0"
}