GithubHelp home page GithubHelp logo

phoenix1406 / book-management-api Goto Github PK

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

This is a simple prototype build for addressing and managing functionalities for a book management system

JavaScript 100.00%

book-management-api's Introduction

Book Management API

This is a simple API for managing books. It uses JSON Web Tokens (JWT) for authentication , brcypt for password hashing and body parser for parsing the incoming requests .

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

You need to have Node.js and npm installed on your machine.

Installing

  1. Clone the repository: git clone https://github.com/yourusername/book-management-api.git
  2. Navigate into the project directory: cd book-management-api
  3. Install the dependencies: npm install

Running the application

To start the server, run: node index.js

As this is using my local storage so i haven't integrate it with using mongo db cluster but it performs all the functionalities.So you have to go thorugh series of steps inorder to test the api.

First perform registration of the user it will register you then you need to login your user by providing your credentials(username and password) this will perform your authentication and then it will provide you the token for your user so for testing other api's please use that token you can use to test other routes as well

API Endpoints

  • POST /register: Register a new user. The body of the request should be a JSON object with username and password fields.
  • POST /login: Log in a user. The body of the request should be a JSON object with username and password fields. The response will be a JWT token.
  • GET /books: Get a list of all books. This endpoint requires authentication. The JWT token should be included in the Authorization header of the request.
  • GET /books/:id: Get a book by its id. This endpoint requires authentication. The JWT token should be included in the Authorization header of the request. The id parameter should be the id of the book.
  • POST /books : Add a new book. This endpoint requires authentication. The JWT token should be included in the Authorization header of the request. The body of the request should be a JSON object with title and author and publicationYear fields.
  • PUT /books/:id : Update a book. This endpoint requires authentication. The JWT token should be included in the Authorization header of the request. The id parameter should be the id of the book. The body of the request should be a JSON object with title and author and publicationYear fields.
  • DELETE /books/:id : Delete a book. This endpoint requires authentication. The JWT token should be included in the Authorization header of the request. The id parameter should be the id of the book.
  • GET/books/author/:author : Get a list of books by author. This endpoint requires authentication. The JWT token should be included in the Authorization header of the request. The author parameter should be the author of the book.
  • GET/books/year/:year : Get a list of books by year. This endpoint requires authentication. The JWT token should be included in the Authorization header of the request. The year parameter should be the year of the book.

These are all the routes prepared in order to depict the fucntionality of basic prototype of book management system

** As it is the basic implementation a prototype of book management system so it is not having any security features like CORS and helmet and xss-clean and express-rate-limit and also mongo db atlas cluster is not integrated in this project. But I can build all those functionalities and make it a complete more advanced project but still it will support all the requirements which were asked by me to design this project **

Built With

Authors

book-management-api's People

Contributors

phoenix1406 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.