-
-
Save limptwiglet/1472057 to your computer and use it in GitHub Desktop.
flatiron example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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