Tutorial using express.static

Posted in Tutorials

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

The express.static middleware let user access a public directory.  Continuing from our last tutorial, we add the statement …

app.use(express.static(__dirname + ‘/public’));

And create a public directory with a css directory inside where you can put style.css like so …

express using static

express using static

Now your stylesheet can be easily access with …

http://localhost:3000/css/style.css