Skip to content

Instantly share code, notes, and snippets.

@kriskowal
Last active June 22, 2016 04:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kriskowal/593082 to your computer and use it in GitHub Desktop.
Save kriskowal/593082 to your computer and use it in GitHub Desktop.
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