MongoDB Database Restful API

by Jimmy Huynh

Posted on August 1, 2019 at 4:50 PM

GitHub Repository

A simple API that edits, creates, read and deletes items from a database.


Libraries used
  • 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.


  1. To test download PostMan.
  2. Create a mongoDB Atlas account.
  3. Create a cluster and get connection link.
  4. Put connection link in DB_CONNECTION variable located in the .env file.
  5. Use Postman to connect to http://localhost:3000/posts/ and play around with post, delete and get data from database.

Frameworks and Projects