public
Last active

  • Download Gist
q-http-queue.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
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);
}
};
};

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.