Category Archives: Express

Quick application scaffolding with Express

Ok, maybe I am the only one who didn’t know this but getting a basic application scaffolding set up in Node is ridiculously easy…. Check this out.


In a terminal window.. Create a new directory… Called what you want. 

mkdir NewTestApp ; cd NewTestApp

install express globally so you can execute it from the command line. 

npm install -g express

now, express will create a full blown Node app with express, jade, all of your parsers, and routing with one simple command… 

express newAppName

Done, lots of stuff installed and ready to go. But, before you go anywhere, you need to get the dependancies installed. cd into the new directory and run npm install. 

cd newAppName && npm install

That will get everything installed and ready to go. The way it sets everything up to run is with a script in /bin/www that starts up the server on port 3000… To start it up, run this:

DEBUG=my-application ./bin/www

Done. Take a few minutes to look around and see how the routing is done but this approach will save you from having to redo all the requires and initial routing work every time you want to play with something.