mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
fcd275f6c0
refs #9866 - Moved web/middleware to web/shared/middlewares - Moved util file to web/shared/utils
17 lines
569 B
JavaScript
17 lines
569 B
JavaScript
const ghostVersion = require('../../../lib/ghost-version');
|
|
|
|
// ### GhostLocals Middleware
|
|
// Expose the standard locals that every request will need to have available
|
|
module.exports = function ghostLocals(req, res, next) {
|
|
// Make sure we have a locals value.
|
|
res.locals = res.locals || {};
|
|
// The current Ghost version
|
|
res.locals.version = ghostVersion.full;
|
|
// The current Ghost version, but only major.minor
|
|
res.locals.safeVersion = ghostVersion.safe;
|
|
// relative path from the URL
|
|
res.locals.relativeUrl = req.path;
|
|
|
|
next();
|
|
};
|