- ๐ About the Project
- ๐ป Getting Started
- ๐ฅ Author
- ๐ค Contributing
- โญ๏ธ Show your support
- ๐ Acknowledgements
- ๐ License
Bookstore API is a backend service used to perform CRUD operation with books. It is built with NodeJS and uses MongoDB as the database.
Server
Database
- API Endpoints to perform CRUD operations
- Database deployment on Mongo Atlas
To get a local copy up and running, follow these steps.
Clone this repository to your desired folder:
git clone https://github.com/mailsg/crudlib.git
cd crudlib
Install this project by executing the following commands. Since its an Open API, there is no need to set up any API keys:
cd crudlib
npm install
touch .env
`Add the following lines to the .env file`
MONGODB_URI=`Your MongoDB-Atlas URI (mongodb+srv)`
DATABASE_NAME=`Your MongoDB Database Name`
COLLECTION_NAME=`Your MongoDB Collection Name`
- Please note that the above 3 variables are mandatory for the project to run.
- I have used Database Name as `library` and Collection Name as `books` for this project. You can use any name of your choice or use the same as mine.
- The database and collection has to be created manually in MongoDB Atlas.
To run the project, execute the following command:
npm start
Below are the Endpoints to perform CRUD operations:
- GET
http://localhost:3000/api/books
- Get all books - GET
http://localhost:3000/api/books/:id
- Get a book by id - POST
http://localhost:3000/api/books
- Create a new book- Request Body
{ "title": "Book Title", "author": "Book Author", "summary": "Book Summary" }
- Request Body
- PUT
http://localhost:3000/api/books/:id
- Update a book by id- Request Body (Any or all of the following)
{ "title": "Book Title", "author": "Book Author", "summary": "Book Summary" }
- Request Body (Any or all of the following)
- DELETE
http://localhost:3000/api/books/:id
- Delete a book by id
๐ค Sandeep Ghosh
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
If you like this project consider leaving a star to the repository.
Thank you for giving me the opportunity to showcase my skills.
This project is MIT licensed.