Last active
June 22, 2016 04:34
-
-
Save kriskowal/593082 to your computer and use it in GitHub Desktop.
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
var HTTP = require("q-io/http"); | |
var Q = require("q"); | |
var Queue = require("q/queue"); | |
var port = 8000; | |
exports.QueueApp = function () { | |
var queue = Queue(); | |
return function (request) { | |
if (request.method == "GET") { | |
return { | |
"status": 200, | |
"headers": {"Content-Type": "text/plain"}, | |
"body": queue.get() | |
}; | |
} else if (request.method == "POST") { | |
queue.put(request.body); | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment