Table of Contents
The Book Management System is a server-side application built with Node.js that allows users to manage a collection of books. It utilizes a Redis in-memory database to store book data and provides various API endpoints to perform CRUD (Create, Read, Update, Delete) operations on the books. Additionally, the project includes a Command Line Interface (CLI) app that allows users to interact with the API directly from the command line.
- Get a list of all books in the collection.
- Get a book by its ISBN number.
- Create a new book and add it to the collection.
- Update an existing book by its ISBN number.
- Delete a book by its ISBN number.
- Search for books by title or author.
- NodeJs - Cross-platform JavaScript runtime environment
- Redis - in-memory data store
- Jest - Javascript testing framework
- Nodemon - For monitoring changes and automatically reloading my server
- Supertest - Library for testing HTTP servers
- Commander - Library for building CLI(command line interfaces)
- Node.js (version 18 or above)
- Redis Server (running on the default port 6379)
- npm
npm install npm@latest -g
- Clone the repository:
git clone https://github.com/techemmy/Book-Management-System
- Install Dependencies
cd Book-Management-System npm install
- Set up environment variables and fill in it as appropriate
cp .example.env .env
-
Start your redis server depending on how you installed it
redis-server
-
Start the server
npm run start
-
Access the API: The API will be available at http://localhost:3000 (change the port if you specified a different one in the .env file).
GET /books
: Get a list of all books.GET /books/:ISBN
: Get a book by its ISBN number.POST /books
: Create a new book.PATCH /books/:ISBN
: Update an existing book by its ISBN number.DELETE /books/:ISBN
: Delete a book by its ISBN number.GET /books/search?term=keyword
: Search for books by title or author using the provided search term.
-
Make sure you have installed and started running your server
-
Configure the CLI. To make sure you have the CLI app installed globally on your PC, Run this command in the base directory of the project:
npm link
-
To use the CLI, run this command on your terminal
book-manager help
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Emmanuel Oloyede - @Itechemmy
Project Link: https://github.com/techemmy/Book-Management-System