Skip to content

This repository contains a simple Nodejs API that performs CRUD (Create, Read, Update, Delete) operations on a MongoDB database. The API is well commented and follows a scalable folder structure that separates the routes, controllers, models and utilities. ๐Ÿ˜Š

Notifications You must be signed in to change notification settings

GiridharsaiTinnaluri/simple-node-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

simple-node-api

This repository contains a simple Nodejs API that performs CRUD (Create, Read, Update, Delete) operations on a MongoDB database. The API is well commented and follows a scalable folder structure that separates the routes, controllers, models and utilities. ๐Ÿ˜Š

To run the API, you need to have Node.js and MongoDB(or Mongodb Atlas) installed on your machine. Then, clone this repository and run npm install to install the dependencies. Next, create a .env file in the root folder and add your MongoDB connection string as MONGO_URI and PORT. Finally, run npm start to start the server.

The API has four endpoints:

  • GET /products/: Returns a list of all products in the database. ๐Ÿ“ƒ
  • POST /products/create: Creates a new product with the given name and quantity in the body of the request. Returns the created product. ๐Ÿ†•
  • PUT /products/:id/update_quantity/?number=10: Updates the product with the given id with the name and quantity in the body of the request. Returns the updated product. ๐Ÿ”„
  • DELETE /products/:id: Deletes the product with the given id from the database. Returns a message confirming the deletion. โŒ

You can use tools like Postman or curl to test the API. ๐Ÿ˜Ž

Demo Link

firebase link -

About

This repository contains a simple Nodejs API that performs CRUD (Create, Read, Update, Delete) operations on a MongoDB database. The API is well commented and follows a scalable folder structure that separates the routes, controllers, models and utilities. ๐Ÿ˜Š

Topics

Resources

Stars

Watchers

Forks