Giter Site home page Giter Site logo

book-management-api's Introduction

Book Management API

This repository contains a simple REST API for managing books, built with NestJS, Prisma, and SQLite.

Setup

Follow these steps to set up the project locally:

  1. Clone the Repository:

    git clone https://github.com/Enigma-52/Book-Management-API
    cd book-management-api
  2. Install Dependencies:

    npm install
  3. Install Prisma: If you haven't installed Prisma globally, you can install it as a dev dependency for this project by running:

    npm install prisma --save-dev
  4. Run Migrations:

    npx prisma migrate dev
  5. Generate Prisma Client:

    npx prisma generate
  6. Start the Server:

    npm run start:dev
  7. Access Swagger Documentation: Open your browser and navigate to http://localhost:3000/api to view the Swagger documentation for the API.

  8. Main API URL: The API can be accessed at http://localhost:3000

Tech Stack Used

  • NestJS: Main framework for the application.
  • Prisma: ORM for interacting with the SQL database.
  • SQLite: SQL database used for simplicity.

API Documentation

Endpoints

  • Create a New Book: POST /books

    • Creates a new book with the provided details.
    • Requires a JSON body with title, summary, and publishedDate fields.
  • Retrieve a List of Books: GET /books

    • Retrieves a list of all books stored in the database.
  • Retrieve Details of a Specific Book: GET /books/:id

    • Retrieves details of a specific book identified by its ID.
  • Update Details of a Specific Book: PUT /books/:id

    • Updates details of a specific book identified by its ID.
    • Requires a JSON body with fields to be updated (title, summary, publishedDate).
  • Delete a Specific Book: DELETE /books/:id

    • Deletes a specific book identified by its ID.

Accessing Swagger Documentation

The Swagger documentation for this API is automatically generated and can be accessed by following these steps:

  1. Ensure the server is running locally. If not, start the server using the command:

    npm run start:dev
  2. Open your web browser and navigate to the following URL:

    http://localhost:3000/api
    

This will open the Swagger UI, where you can explore and interact with the API endpoints visually.

6E260184-818A-4BB1-8D36-FD17AC72B397

Code

All code related to the API can be found in the src/book-module directory.

book-management-api's People

Contributors

enigma-52 avatar

Stargazers

 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.