awsmean

Start Express

To start your application server, you just have to execute the following command, inside your application directory:

$ npm start

Alternatively, use the following command to start the server and keep it running even after your server session ends. Replace FILE with the correct filename for your application.

$ forever start FILE.js

If you are using a recent Express version (greater than 4.0), you should use the following command instead:

$ DEBUG=sample:* ./bin/www

Port 3000 is the default port used by Express when creating the template. This means that you may receive an error similar to the below when starting the server:

Error: listen EADDRINUSE
 at errnoException (net.js:670:11)
 at Array.0 (net.js:771:26)
 at EventEmitter._tickCallback (node.js:190:38)

This means that the port is already in use. Edit the app.js script and change the line containing app.listen() to use a different port number, as below. Then, start the application again.

app.listen(4000, function() {
Last modification April 22, 2020