Skip to content

tarikkamat/library-management

Repository files navigation

Library Management

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.

Installation

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

Docker Installation

Make sure Docker Desktop is installed and running on your machine.

  make start
  make migrate
  make seed

API Usage

Get Users

Getting user list with ids and names

  GET /api/users

Get User

Getting a user with no borrow history or his past and current book borrow list

  GET /api/users/${id}

Create User

Getting a user with no borrow history or his past and current book borrow list

  POST /api/users
Parameter Type
name string

Get Books

Getting book list

  GET /api/books

Get Book

Getting a book with its average user score or is not scored yet

  GET /api/books/${id}

Create Book

Creating a book

  POST /api/books
Parameter Type
name string

Borrow Book

User borrowed a book succesfully

  POST /api/users/${userId}/barrow/${bookId}

Return Book

User returning a book with his score

  POST /api/users/${userId}/return/${bookId}
Parameter Type
score int

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published