Skip to content

Instantly share code, notes, and snippets.

@hvrauhal
Created August 19, 2015 10:19
Show Gist options
  • Save hvrauhal/f9ce2024ff2f0efdc533 to your computer and use it in GitHub Desktop.
Save hvrauhal/f9ce2024ff2f0efdc533 to your computer and use it in GitHub Desktop.
Serve static files using express.js
var express = require('express')
var app = express()
var port = process.env.PORT || 8010
module.exports = app
app.use(require('morgan')('combined'))
app.use(function (req, res, next) {
console.log('starting', req.url, JSON.stringify(req.headers))
next()
})
app.use(express.static(__dirname + '/www'))
app.listen(port)
util.log('Server running at port ' + port)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment