Created
December 23, 2018 13:16
-
-
Save pariola/491407333d0bad13e0aee67d83a80229 to your computer and use it in GitHub Desktop.
Using the middleware pattern in now.sh
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
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