Skip to content

Instantly share code, notes, and snippets.

@pariola
Created December 23, 2018 13:16
Show Gist options
  • Save pariola/491407333d0bad13e0aee67d83a80229 to your computer and use it in GitHub Desktop.
Save pariola/491407333d0bad13e0aee67d83a80229 to your computer and use it in GitHub Desktop.
Using the middleware pattern in now.sh
const Chain = require("middleware-chain-js");
const bodyParser = require("body-parser");
const app = new Chain();
//* parses JSON content
app.use(bodyParser.json());
app.use(function(req, res) {
console.log(req.body);
res.end("Hello!");
});
module.exports = function(req, res) {
app.handle(req, res);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment