This project provides a RESTful API to manage users, books, and borrowing/returning relationships in a library system. Built with Node.js, Express, and Sequelize ORM, it supports CRUD operations.
Clone the project
git clone https://github.com/tarikkamat/library-management.git
Go to the project directory
cd library-management
Install necessary packages
npm install
Run migration
npx sequelize db:migrate
If you want, you can seed with dummy information.
npx sequelize db:seed:all
Make sure Docker Desktop is installed and running on your machine.
make start
make migrate
make seed
Getting user list with ids and names
GET /api/users
Getting a user with no borrow history or his past and current book borrow list
GET /api/users/${id}
Getting a user with no borrow history or his past and current book borrow list
POST /api/users
Parameter | Type |
---|---|
name |
string |
Getting book list
GET /api/books
Getting a book with its average user score or is not scored yet
GET /api/books/${id}
Creating a book
POST /api/books
Parameter | Type |
---|---|
name |
string |
User borrowed a book succesfully
POST /api/users/${userId}/barrow/${bookId}
User returning a book with his score
POST /api/users/${userId}/return/${bookId}
Parameter | Type |
---|---|
score |
int |