How To Build Simple CRUD RESTful API With NodeJS, ExpressJS And MongoDB in 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