Making an Express web app
In this recipe, we're going to combine a lot of previous recipes and throw in a few extra Express features (such as app mounting) to create the foundations of an Express-based web app with integrated administration features.
Getting ready
Let's start fresh. From the command line, we execute the following command:
express profiler
The name of our new app will be Profiler
; it will be the profile manager for members of the Node community.
We need to edit package.json
using the following code:
{ "name": "Profiler", "version": "0.0.1", "private": true, "scripts": { "start": "node ./bin/www" }, "dependencies": { "express": "~4.0.0-rc2", "static-favicon": "~1.0.0", "morgan": "~1.0.0", "cookie-parser": "~1.0.1", "body-parser": "~1.0.0", "debug": "~0.7.4", "jade": "~1.3.0", "stylus": "~0.42.3", "express-flash": "0.0.2", "mongodb": "~1.3.23" } }
We've set the name to Profiler
, adding stylus
, mongodb
, and express-flash
...