REST API for managing personal notes.
A complete RESTful API created using Node.js and Express. We have used MongoDB as the database and mongoose as the ORM library which makes it easier to interact with MongoDB. Apart from this, we have used JSON Web Token (JWT) to add authentication. Using JWT, we can protect certain endpoints and ensure that user must be logged-in to access those.
Here are all the videos where we have created this API from scratch - Youtube Playlist
-
Clone the repo from GitHub
git clone https://github.com/pairlearning/personal-notes-mgr-api.git cd personal-notes-mgr-api
-
Install all npm dependencies
npm install
-
Setup MongoDB
There are lots of options available to have a running MongoDB instance:
- a typical way is to download the community edition from here and install locally on the machine
- another option is to spin-up an instance on the cloud. Here are step-by-step instruction for that - Get Started with Atlas
- another option is by running a mongodb docker container. If docker is installed, its simply a matter of running single command to spin-up a database instance:
docker container run --name mongodb -d -p 27017:27017 mongo
-
Update database URL in config.js file
once you have the DB URL, specify that in config.js file:
module.exports = { MONGODB: 'mongodb://localhost:27017/personalnotesmgr', ... };
-
Run npm start the start the application
npm start
this runs at port 3300 and hence all enpoints can be accessed starting from http://localhost:3300