How To Build Simple CRUD RESTful API With NodeJS, ExpressJS And MongoDB in 2022

Muhammad Ali
11 min readFeb 4, 2022

Introduction

Node js is a popular backend nowadays! It’s fast and easy to write code. If you already know javascript, it can be easy to write node js. So we’re going to explore express js today with MongoDB for the database. We’ll create the rest API endpoints and implement CRUD operation for the to-do list. The example is quite basic, but we’re going to make a good project structure so that you can follow it for your other projects too! Let’s dive in –

Things I’m using

Vscode: I’ve used the vscode for the whole development!

Node js: I’ve used node js v14.8.0

MongoDB compass: I’ve used MongoDB v1.30.1 to see all changes in MongoDB graphically

Postman: We’ll use this one to test all our API’s

Packages:

  • babel: For transpile the javascript into an older version
  • cors: For the CORS setting
  • dotenv: For reading the environment variables
  • eslint: For enforcing a coding style
  • express js: The node framework
  • express-rate-limit: For limiting the API endpoint calls

--

--

Muhammad Ali

An otaku who loves computer. Love to write and help others through my work. Have a look on my Instagram https://www.instagram.com/nerd_jfpb/