Code Monkey home page Code Monkey logo

book-management-api's Introduction

Book Management API

Technologies Used

  • Node.js
  • Express.js
  • MongoDB
  • Mongoose
  • Swagger
  • JavaScript

Features

  • Create a new book record.
  • Retrieve a list of all books.
  • Retrieve a book by its unique identifier.
  • Update an existing book record.
  • Delete a book by its unique identifier.

Getting Started

  1. Clone the repository to your local machine.

    git clone https://www.github.com/ankit2web/book-management-api.git
  2. Install the required dependencies.

    npm install
  3. Start the server.

    npm start

    The server should be running on http://localhost:5000.

API Endpoints

Create a new book

  • URL: /books
  • Method: POST
  • Description: Upload a new book record to the database.
  • Request Body: JSON data containing book details (title, author, summary, isbn).
  • Responses:
    • 201: Book uploaded successfully.
    • 400: Book already exists.

Retrieve a list of all books

  • URL: /books
  • Method: GET
  • Description: Retrieve a list of all books from the database.
  • Responses:
    • 200: A list of books retrieved successfully.
    • 500: Internal server error.

Retrieve a book by ID

  • URL: /book/:id
  • Method: GET
  • Description: Retrieve a book by its unique identifier.
  • Parameters: id (string) - The unique identifier of the book to retrieve.
  • Responses:
    • 200: Book retrieved successfully.
    • 404: Book not found.
    • 500: Internal server error.

Update a book by ID

  • URL: /book/:id
  • Method: PUT
  • Description: Update a book record using its unique identifier.
  • Parameters: id (string) - The unique identifier of the book to update.
  • Request Body: JSON data containing book details to update (title, author, summary, isbn).
  • Responses:
    • 200: Book updated successfully.
    • 404: Book not found.
    • 500: Internal server error.

Delete a book by ID

  • URL: /book/:id
  • Method: DELETE
  • Description: Delete a book record using its unique identifier.
  • Parameters: id (string) - The unique identifier of the book to delete.
  • Responses:
    • 200: Book deleted successfully.
    • 404: Book not found.
    • 500: Internal server error.

Documentation

The API is documented using Swagger. You can access the Swagger documentation by running the server and visiting the following URL:

http://localhost:5000/api-docs

Deployment

This API will be deployed to AWS EC2 for production use.

Update: Deployed to t2.micro EC2 instance and is available at http://3.85.132.65/api-docs

Contact Details

book-management-api's People

Stargazers

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