Skip to content

Instantly share code, notes, and snippets.

Created July 21, 2013 10:48
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
CoffeesScript generator based webserver
// Translated from
// Uses my fork of CoffeeScript with the yield statement added at
mach = require('mach')
app = mach.stack()
Q = require('q')
sleep = (millis, answer) ->
deferredResult = Q.defer()
), millis)
app.use mach.commonLogger Q.async (request) ->
body = yield request.parseContent()
yield sleep(200)
return JSON.stringify({requestBody: body})
mach.serve(app, 3333)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment