Created
December 3, 2012 22:47
-
-
Save afternoon/4198841 to your computer and use it in GitHub Desktop.
nodemachine resource in coffeescript
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
sys = require("sys") | |
http = require("http") | |
nodemachine = require("nodemachine") | |
class EchoMachine extends nodemachine.App | |
canHandleResource: (context) -> true | |
getResource: (context, callback) -> | |
context.res.sendBody(context.req.url) | |
callback(context, true) | |
port = process.argv[2] or 80 | |
server = nodemachine.createServer(port) | |
server.addApp(new EchoMachine()) | |
server.start() | |
console.log("Started nodemachine on port #{port}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment