Skip to content

Instantly share code, notes, and snippets.

@leeola
Created October 11, 2012 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leeola/d7848f07b7f5a355fb33 to your computer and use it in GitHub Desktop.
Save leeola/d7848f07b7f5a355fb33 to your computer and use it in GitHub Desktop.
var flatiron = require('flatiron'),
app = flatiron.app;
app.use(flatiron.plugins.http, {
// HTTP options
});
//
// app.router is now available. app[HTTP-VERB] is also available
// as a shortcut for creating routes
//
app.router.get('/version', function () {
console.log('Connection made.');
this.res.writeHead(200, { 'Content-Type': 'text/plain' })
this.res.end('flatiron ' + flatiron.version);
});
console.log('Listening for connections..');
app.start(8080);
// Set our timeouts..
setTimeout(function () { console.log('1 second'); }, 1000);
setTimeout(function () { console.log('4 seconds'); }, 4000);
setTimeout(function () { console.log('8 seconds'); }, 8000);
setTimeout(function () {
console.log('12 seconds');
app.server.close(function () {
console.log('Server close callback.');
});
}, 12000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment