REST API server implementation built on top Node.js
and Express.js
with Mongoose.js
for MongoDB
integration.
You need to have Node.js and MongoDB installed.
# Update Homebrew before installing all dependencies
brew update
# Install Node (+npm) with Homebrew
brew install node
# Install npm dependencies in project folder
npm install
# 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
node app.js
# Make sure you clone the repo and docker compose is installed in the machine
# By default the port is 3000
docker-compose up
{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
Some of non-standard modules used:
- Integration of authorization