Creating a basic API with Express
Express is the most popularNode.js framework and is easy to install and to use. In this recipe we are going to create, configure, and install a basic API using Express.
Getting ready
First, we need to install Node. You need to go to the official website, www.nodejs.org, and then download Node.js. There are two versions: the LTS (Long Term Support) version and the current version, which has the latest features. In my opinion, it is always better to choose the LTS version, but it's up to you.
Once you have installed Node, you can check which version you have by running this command in your Terminal:
node-v v10.8.0
Also, Node includes Node Package Manager (npm) by default. You can check which version you have with this command:
npm-v 6.3.0
Now we need to install Express. To do this, there is a package called express-generator
, which will allow us to create an Express application with a simple command. We need to install it globally:
npm install -g express-generator...