Created
August 7, 2017 11:06
-
-
Save harish2704/4db71f8c1c124e578aed688a936cdbea to your computer and use it in GitHub Desktop.
Dummy express server for logging in comming request
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 port = process.env.PORT || 4005; | |
app.use( function( req, res ){ | |
[ | |
'method', | |
'url', | |
'headers', | |
'query', | |
'body' | |
] | |
.forEach(function( item ){ | |
console.log( item, req[item] ); | |
}); | |
res.send('Ok'); | |
}); | |
app.listen( port, function( err ){ | |
if( err ){ | |
console.log( 'Error', err ); | |
process.exit( -1 ); | |
} | |
console.log( 'Listening on '+ port ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment