Giter VIP home page Giter VIP logo

rest-api-server's Introduction

Book API with CRUD Operations

This project is a Node.js API server with CRUD operations for managing a collection of APIs. The API uses MongoDB as the database.

Features

  • Create, Read, Update, and Delete API in the MongoDB database.
  • Uses Express.js for the server and Mongoose for MongoDB interactions.

Getting Started

Follow these instructions to set up and run the project on your local machine.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/rest-api-server.git
    cd rest-api-server
  2. Install dependencies:

    npm install
  3. Set up environment variables:

    Create a .env file in the root directory and add your MongoDB connection string and the port number:

    MONGODB_URI=mongodb+srv://<username>:<password>@cluster0.mongodb.net/<dbname>?retryWrites=true&w=majority
    PORT=3000
    
  4. Seed the database (optional):

    To seed the database with initial data, run:

    npm run data:import

    To destroy the seeded data, run:

    npm run data:destroy

Running the Server

Start the server in development mode with:

npm run dev

api for CREATE, READALL, READ, UPDATE, DELETE

create record

http://localhost:3000/api/create

get all data

http://localhost:3000/api/getAll

get data by id

http://localhost:3000/api/[give_id]

update record by id

http://localhost:3000/api/update/[give_id]

delete record by id

http://localhost:3000/api/delete/[give_id]

rest-api-server's People

Contributors

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