Created
August 25, 2016 15:24
-
-
Save freakynit/b1efcf9259e5ef702f858c299e7898a5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 PORT = 9999; | |
| var express = require('express'); | |
| var cookieParser = require('cookie-parser'); | |
| var bodyParser = require('body-parser'); | |
| var app = express(); | |
| app.use(bodyParser.json()); | |
| app.use(bodyParser.urlencoded({ extended: false })); | |
| app.use(cookieParser()); | |
| app.all("*", function(req, res, next){ | |
| console.log("===================== New request ====================="); | |
| console.log("Body: " + JSON.stringify(req.body)); | |
| console.log("Query: " + JSON.stringify(req.query)); | |
| console.log("Params: " + JSON.stringify(req.params)); | |
| console.log("Headers: " + JSON.stringify(req.headers)); | |
| console.log("\n\n"); | |
| res.json({"status": "success"}); | |
| }); | |
| app.listen(PORT); |
This file contains hidden or 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
| { | |
| "name": "request_logger", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "app.js", | |
| "dependencies": { | |
| "body-parser": "^1.15.2", | |
| "cookie-parser": "^1.4.3", | |
| "express-logging": "^1.1.1", | |
| "logops": "^1.0.5", | |
| "express": "^4.14.0" | |
| }, | |
| "devDependencies": {}, | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "author": "Nitin Bansal <[email protected]> (http://webengage.com)", | |
| "license": "ISC" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment