Skip to content

ranitdey/RestFull-API-NodeJS

Repository files navigation

RestFull-API-NodeJS-MongoDB

CI Status Dependency Status

REST API server implementation built on top Node.js and Express.js with Mongoose.js for MongoDB integration.

Running project

Manual

You need to have Node.js and MongoDB installed.

Node setup on macOS

# Update Homebrew before installing all dependencies
brew update

# Install Node (+npm) with Homebrew
brew install node

# Install npm dependencies in project folder
npm install

MongoDB setup on macOS

# Install MongoDB with Homebrew
brew install mongodb

# Create directory for MongoDB data
mkdir -p ./data/mongo

# Run MongoDB daemon process with path to data directory
mongod --dbpath ./data/mongo

Run server

node app.js

Run server with docker

# Make sure you clone the repo and docker compose is installed in the machine
# By default the port is 3000
docker-compose up

Endpoints

{get} http://localhost:3000/api/courses/ : This will fetch all the courses from MongoDB with a rate limiter.

{post} http://localhost:3000/api/courses/ : This endpoint will allow user to add courses. Request should be made with respect tp proper Json contract.

# contract example
{
  "name": "Machine Learning",
  "tags": ["AI","ML"],
  "author": "peter",
  "ispublished": false,
}

{put} http://localhost:3000/api/courses/{id} : This endpoint will allow user to update courses. Request should be made with respect tp proper Json contract.
{delete} http://localhost:3000/api/courses/ : This will allow user to delete courses from MongoDB

Modules used

Some of non-standard modules used:

Current TODO

  • Integration of authorization

About

RestFull backend API's using NodeJS and Express

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published