Build A Restful Api With Node.js Express & MongoDB
We are going to cover how to create a restful api using node.js express and mongodb together with mongoose.
Rest apis help us decouple our backend code from our front end so we can use it across multiple application (mobile apps, web apps, etc). We are going to learn how to build a simple blog post type api with all the useful methods(GET,POST,DELETE,PATCH).
We use Node.js as our backend language, express.js is going to help us create routes easier and middlewares and we use mongodb together with mongoose to create schemas and models that define how our data looks.
If you are a beginner with nodejs, express or mongodb I hope that this tutorial will give you a good idea of how these technologies work well together.
-
npm init -y
-
npm i express nodemon
- make start call in package.json:
"start": "nodemon app.js"
-
touch app.js
- follow express.js quick start guide
- connect to mongo and mongoose with this tutorial
- [ ]