An API for you if you have a large book collection and buy the same book multiple times by mistake because you couldn't keep track of them. Ahem! 🤓
bookman is actually a REST based personal book collection manager API where you can
- Add your books
- Edit book information
- View them
- Search for any book
- Supports multiple user accounts
So you can just add a front end on top of it and you're done. Just like that! (I wish adding a front end was that easy!)
Check the package.json file.
Make sure your monogodb instance is running before you jump in.
yarn install
yarn run start-watch
yarn run test-watch
Server will be running on http://localhost:3000
- Registers or signs up a new user.
- Request body should include
name
,email
andpassword
. - Request body example:
{
"name": "XYZ",
"email": "[email protected]",
"password": "123456"
}
- Each registered user gets an
auth token
- Logs in an user.
- Request body has to include
email
andpassword
. - Request body example:
{
"email": "[email protected]",
"password": "123456"
}
- User gets a
auth token
on every login.
- Deletes the
auth token
generated duringlogin
. - And logs the User out.
- User gets validated via the
auth token
he/she was given duringlogin
.
Response on logout:
{
"message": "User has been logged out!"
}
- Gets all the books.
- Gets a book by mongodb id.
- Gets a book by name.
- Gets a book by author name.
- Add a book to collection
Example request:
{
"name": "Physics of the Impossible",
"author": "Michio Kaku",
}
Example Response:
{
"addedOn": "Wed Jun 27 2018 22:21:00 GMT+0600 (+06)",
"_id": "5b33b96c32b27c4100d72995",
"name": "Physics of the Impossible",
"author": "Michio Kaku",
"addedBy": "Shawon",
"__v": 0
}
- Update a book info by mongodb id.
- Deletes a book from the collection.
There are multiple ways. You can use curl
or use a client like Postman.
Server logs are generated by morgan in combined
mode.
MIT