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

After we installed express-generator, we can create an Express application. I usually prefer to create a directory called projects inside my home folder on my Mac, or if you use Windows, you can make it at C:projects:

express my-first-express-app

Once you run the command, you will see something like this:

If you follow the instructions to run the application, you will see the Express application running at http://localhost:3000:

    cd my-first-express-app
npm install
npm start

You will see this view:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset