Skip to content

Commit

Permalink
docs: use standard style in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jun 11, 2016
1 parent f281443 commit 1b2b56b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ var serveStatic = require('serve-static')
var serve = serveStatic('public/ftp', {'index': ['index.html', 'index.htm']})

// Create server
var server = http.createServer(function(req, res){
var done = finalhandler(req, res)
serve(req, res, done)
var server = http.createServer(function onRequest (req, res) {
serve(req, res, finalhandler(req, res))
})

// Listen
Expand All @@ -160,9 +159,8 @@ function setHeaders(res, path) {
}

// Create server
var server = http.createServer(function(req, res){
var done = finalhandler(req, res)
serve(req, res, done)
var server = http.createServer(function onRequest (req, res) {
serve(req, res, finalhandler(req, res))
})

// Listen
Expand Down Expand Up @@ -221,7 +219,7 @@ app.use(serveStatic(__dirname + '/public', {

app.listen(3000)

function setCustomCacheControl(res, path) {
function setCustomCacheControl (res, path) {
if (serveStatic.mime.lookup(path) === 'text/html') {
// Custom Cache-Control for HTML files
res.setHeader('Cache-Control', 'public, max-age=0')
Expand Down

0 comments on commit 1b2b56b

Please sign in to comment.