Skip to content

Instantly share code, notes, and snippets.

@limptwiglet
Created December 13, 2011 13:03
Show Gist options
  • Save limptwiglet/1472057 to your computer and use it in GitHub Desktop.
Save limptwiglet/1472057 to your computer and use it in GitHub Desktop.
flatiron example
// libs
var flatiron = require('flatiron');
var fs = require('fs');
// create app
var app = flatiron.app;
app.use(flatiron.plugins.http);
// router logic
app.router.get('/', function () {
var markup, self = this;
fs.readFile('start.html', function (err, data) {
if (err) throw err;
markup = data.toString();
self.res.writeHead(200, { 'Content-Type': 'text/html' });
self.res.write('!' + markup);
self.res.end();
});
});
// start on port 8080
app.start(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment