Booting up the application

Let's take your server for a spin and see how you're doing so far:

$ node server.js
Server up: http://localhost:3300  

Perfect! At this point, your server doesn't actually do anything great. Try pointing your browser to http://localhost:3300. You should receive a pretty basic message that says Hello World! If you request any other routes on the port, such as http://localhost:3300/, it will respond with a cannot get response. This is because you haven't configured any routes or any actual logic in your server to say how to handle certain requests, but only a GET request to the default route of /.

Before you set up your routes, we should understand the concept of middleware in Express, which will be essential to understand how the modules that are custom dependencies of our application get integrated with our normal application flow.

You can set any number of environment variables right from the command line before you run your server by executing something like the following command:

$   PORT=5500 node server.js
Server   up: http://localhost:5500   
You can also set environment variables in your environment settings permanently. This can be done typically by editing your .profile file or equivalent.
..................Content has been hidden....................

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