Skip to content

Instantly share code, notes, and snippets.

@framlin
Forked from timoxley/index.js
Created April 6, 2012 09:26
Show Gist options
  • Save framlin/2318464 to your computer and use it in GitHub Desktop.
Save framlin/2318464 to your computer and use it in GitHub Desktop.
flatiron ip address middleware
var union = require('union');
var flatiron = require('flatiron');
var ecstatic = require('ecstatic');
app = new flatiron.App();
app.use(flatiron.plugins.http);
app.http.before = [
function (req, res) {
//this logs >> info: REQ - hello clientundefined
app.log.info("REQ - hello client" + req.socket);
res.emit('next');
},
ecstatic(__dirname + '/../site')
];
app.start(8081);
// HEERE is the tail -f output:
arn: Forever detected script exited with code: null
warn: Forever restarting script for 5 time
info: REQ - hello clientundefined
info: REQ - hello clientundefined
info: REQ - hello clientundefined
info: REQ - hello clientundefined
info: REQ - hello clientundefined
info: REQ - hello clientundefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment