- First, let's start writing our REST API. We will do that by creating an express post endpoint. This endpoint will be porting our data to the server, but before that, let's install some dependencies using the following line:
~> npm install express body-parser --save
Let's discuss what we just did:
- We're using npm to download ExpressJS locally to our development directory.
- Also, we're downloading body-parser. This is an ExpressJS middleware that will host all post requests data underneath the body subobject. This module is quite a common package in the NodeJS community, and you will find it pretty much everywhere.
- Now, let's configure our application. Head to the app.js file and add the following code lines there: