Created
November 9, 2018 00:59
-
-
Save packetchef/6fba98558ae18b975eb4986dc59da3b6 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
const port = 3000 | |
const express = require('express') | |
const app = express() | |
app.use(function(req, res, next){ | |
console.log('Request:', req) | |
console.log('Response:', res) | |
next() | |
}) | |
app.get('/', function(req, res, next){ | |
res.send('Hello') | |
res.send(req.parm1) | |
}) | |
app.get('/parms', function(req, res, next){ | |
var parm1 = req.parm1 | |
var parm2 = req.parm2 | |
if ( parm1 && parm2 ){ | |
next() | |
} | |
}) | |
app.listen(port, function(){ | |
console.log('Listening on port', port) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment