Improving our API with Express.js
Express.js is an open source web framework created on top of Node.js. We can implement our REST API using the Node.js HTTP module, but we will have to write a lot of code to handle a simple user request. Express.js is very flexible and provides a set of features that will allow us to create robust APIs.
Coding our server
It's time to create our FIFA backend folder and start working on the API development. Open your Terminal and run the following command:
$ mkdir wc-backend $ cd wc-backend $ npm init -y { "name": "wc-backend", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC" }
Once the initialization is done, let's install Express.js. Execute the following command:
$ npm install --save express
Next, create the server.js
file in the root folder and write the following code:
const express = require('express...