- You can signUp as new user here, is a public route. Should Return a accessToken and refreshToken. Default admin role for users that are created in this route is false. Body request should be like:
{
"name": "John Mist",
"email": "mist.john@gmail.com",
"password": "1234"
}
Return_Example
{
"access_token": "eyJhbGciOiJIUzI1N...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsI..."
}
- You can Login in your account here, is a public route. Should Return a accessToken and refreshToken
{
"email": "mist.john@gmail.com",
"password": "1234"
}
- You can refresh accessToken here, passing the refreshToken trough Header param as Bearer Token Authorization, is a route that requires refresh_token. Should Return a accessToken and refreshToken and update user refresh token hash
- You can logout here, passing the accessToken trough Header param as Bearer Token Authorization, is a route that requires refresh_token. Should Return a accessToken and refreshToken and update user refresh token hash
To create Admin user run npx migrate studio
, will open a page in browser http://localhost:5555/
, access Model User
and create an admin user from root with default Admin as true
- Authenticated route to see user profile, passing the accessToken trough Header param as Bearer Token Authorization. Should return User Profile Info
{
"id": "c02868f1-4b15-444e-ad26-d280725fccf8",
"email": "mecl.ely@gmail.com",
"name": "Misael Lopes",
"admin": true,
"created_at": "2022-11-21T14:37:29.988Z",
"updated_at": "2022-11-29T15:24:24.301Z"
}
- To create a new book, you must be logged in as administrator
{
"title": "Domain Driven Design (DDD)",
"description": "A book about best approach on how to get right in development with business domain",
"bar_code": "197382645"
}
- To update book information, you must be logged in as administrator. Add book ID as Route Param, and Body:
{
"title": "Domain Driven Design (DDD)",
"description": "A book about best approach on how to get right in development with business domain",
"bar_code": "197382645"
}
- To delete a book, you must be logged in as administrator. Simply pass the Book ID as route param
- To list all books, you must be logged in as any role user, must return and array like:
[
{
"id": "0b7fe927-d60e-473e-9808-1077a40b9c0f",
"title": "Domain Driven Design (DDD)",
"description": "A book about best approuch on how to get right in development with business domain",
"bar_code": "197382645",
"created_at": "2022-11-29T14:47:43.563Z",
"updated_at": "2022-11-29T14:47:43.563Z"
},
{
"id": "5d4d1e82-02a7-46c7-9922-40d9f1eb9b61",
"title": "Clean Code",
"description": "A Handbook of Agile Software Craftsmanship",
"bar_code": "1894565359",
"created_at": "2022-11-29T16:25:03.089Z",
"updated_at": "2022-11-29T16:25:03.089Z"
}
]