Giter Site home page Giter Site logo

shaku2202 / bookmanagement Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 83 KB

This repository contains the backend code for a Book Management System. The system is built using Node.js, Express.js, MongoDB, and JWT for authentication. It provides APIs for managing books, users, and authentication.

Home Page: https://bookmanagement-ono2.onrender.com/

JavaScript 100.00%
bookmanagementsystem expressjs jwt mongodb nodejs graphql

bookmanagement's Introduction

Book Management System API

Introduction

Welcome to the Book Management System API, a powerful solution for efficiently managing books, borrowing, and purchasing. This API provides administrators with comprehensive tools for book management while enabling users to seamlessly borrow, buy, and explore books.

Deployed App

Backend: Link to deployed backend

Features

  • Admin Privileges: Administrators have full control over managing books within the system.
  • User Interactions: Users can borrow books, buy books, and access the available library.

GraphQL Routes Documentation

Introduction

This document provides an overview of the GraphQL routes available in the Book Management System application. GraphQL is a query language for APIs that enables clients to request only the data they need, allowing for more efficient and flexible data retrieval.

Getting Started

To interact with the GraphQL API, you can use tools like Postman or GraphQL Playground. The GraphQL endpoint is located at /graphql. Ensure that the server is running before making requests to the GraphQL API.

Authentication

Some GraphQL routes require authentication. You need to include an Authorization header with a valid access token to access these routes. The access token should be obtained by logging in using the loginUser mutation.

Available Routes

Queries

getUsers

query {
  getUsers {
    _id
    name
    email
    city
    age
    role
  }
}

getBooks

query {
  getBooks {
    _id
    title
    genre
    author
    published_year
  }
}

getUser

query {
  getUser(id: "user_id_here") {
    _id
    name
    email
    city
    age
    role
  }
}

getBook

query {
  getBook(id: "book_id_here") {
    _id
    title
    genre
    author
    published_year
  }
}
Mutations

registerUser

mutation {
  registerUser(name: "John Doe", email: "[email protected]", pass: "password", role: "reader") {
    _id
    name
    email
    role
  }
}

loginUser

mutation {
  loginUser(email: "[email protected]", pass: "password") {
    access_token
    refresh_token
  }
}

logoutUser

mutation {
  logoutUser {
    msg
  }
}

addBook

mutation {
  addBook(title: "Book Title", genre: "Fantasy", author: "Author Name", published_year: 2022) {
    _id
    title
    genre
    author
    published_year
  }
}

Credentials

Please refer to the codebase for authentication and credentials handling.

Usage

  1. Register as a User: Start by registering as a user to gain access to the library functionalities.

  2. Explore Available Books: Browse through the library to discover the wide range of books available.

  3. Borrow or Buy Books: Choose the desired book and opt to either borrow it or buy it, based on your preference and availability.

  4. Administrator Actions: If you're an administrator, log in to access advanced features like adding, updating, or deleting books from the system.

API Endpoints

  • GET /book - Retrieve all books
  • POST /book/add - Create a new book
  • PATCH /book/update/:id - Update an existing book
  • DELETE /book/delete/:id - Delete a book by ID
  • POST /book/buy/:id - Buy a book
  • POST /book/borrow/:id - Borrow a book

Technology Stack

  • Node.js: Backend JavaScript runtime.
  • Express.js: Web application framework for Node.js.
  • GraphQL: Query language and runtime for APIs.
  • MongoDB: NoSQL database for data storage.
  • Mongoose: MongoDB object modeling tool for Node.js.
  • Other libraries/modules as needed

bookmanagement's People

Contributors

shaku2202 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.