Search code examples
node.jsmacosexpressnvm

Node.js exits clean express starter app.js


I have installed Express using:
nvm install -g express && nvm install -g express-generator
Then I ran:
express -c stylus my_app
to create new blank app, and install dependencies:
nvm install
But, when I node app.js my output is blank/clean and node exits

$ node app.js
$ 

What am i doing wrong?


Solution

  • Create new folder, place new app.js in folder. And put the following code in app.js:

    var app = require('express')();
    app.listen(8080, function (err) {
          if (err) { 
             console.log(err);
          } else {
             console.log("App started at port 8080");
          }    
    });
    

    This is blank express app. And then run in command line: node app.js