Created
June 9, 2017 04:36
-
-
Save manjeshpv/d91aab376989dd7f2b9ef5bbbfcee256 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
// express.js | |
app.use((req, res, next) => { | |
req.v2 = req.get('version') === '2' | |
return next(); | |
}) | |
app.get('/securedapi', (req, res) => { | |
if(req.v2) | |
//new logic | |
return console.log('new logic'); | |
return console.log('old logic') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment