created by Brian LeRoux & Andrew Lunny. sparodically uncurated by David Trejo.

2010 04 16 express js gotcha

Less of a wtf and more of a gotcha. In ExpressJS. you can serve static files from a /public directory with this simple directive in your configure block:

    configure(function() {
        set("root", __dirname);  
        // allow static file serving from public directory

But be careful! This sets a the path to be /public/app.css rather than /app.css. More background here.

Fork me on GitHub