Created
February 28, 2018 15:01
-
-
Save vwvw/929da7b819e2c8acdc256d509857561d 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 express = require('express'); | |
var app = express(); | |
var multer = require('multer') | |
var upload = multer() | |
var bodyParser = require('body-parser'); | |
app.use(bodyParser.json()); // for parsing application/json | |
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded | |
app.get('*', function (req, res) { | |
res.send("URL: " + req.originalUrl + "<br>QUERY PARAM: " + JSON.stringify(req.query) + "<br>BODY PARAM: " + JSON.stringify(req.body) + "<br>HEADERS: " + JSON.stringify(req.headers)); | |
}); | |
app.post('*', upload.any(), function (req, res, next) { | |
res.send("URL: " + req.originalUrl + "<br>QUERY PARAM: " + JSON.stringify(req.query) + "<br>BODY PARAM: " + JSON.stringify(req.body) + "<br>HEADERS: " + JSON.stringify(req.headers)); | |
}) | |
app.listen(80, function () { | |
console.log('Example app listening on port 80!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment