MongoDB Database Restful API
Posted on August 1, 2019 at 4:50 PM
A simple API that edits, creates, read and deletes items from a database.
- Express: Used to create API's.
- Nodemon: Automatically restarting the node application when file changes in the directory are detected.
- Cors: Allow all sites to access the API.
- Dotenv: Hide username and password to connect to database.
- Body-parser: Parse incoming request bodies in a middleware before your handlers.
- Mongoose: MongoDB.
- To test download PostMan.
- Create a mongoDB Atlas account.
- Create a cluster and get connection link.
- Put connection link in DB_CONNECTION variable located in the .env file.
- Use Postman to connect to http://localhost:3000/posts/ and play around with post, delete and get data from database.