Last active
November 3, 2017 17:52
-
-
Save Sysetup/41c687caad5bc63b0ec123b1f31a7bb5 to your computer and use it in GitHub Desktop.
Middleware example. ExpressJS.
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
app.use(getHost, sessionset); | |
sessionset({ | |
secret: 'sysetup-x', | |
resave: false, | |
saveUninitialized: false, | |
name: 'session-x', | |
cookie: { | |
domain: host //var host; //Store hostname get with getHost function. | |
} | |
}) | |
/** | |
* Middleware function to get local domain. | |
*/ | |
var getHost = function (req, res, next) { | |
host = req.get('host'); | |
next(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment