mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 02:41:50 +03:00
24332c3d24
no issue Part of the effort to break up the Ghost codebase into smaller, decoupled modules.
20 lines
730 B
JavaScript
20 lines
730 B
JavaScript
const ghostVersion = require('@tryghost/version');
|
|
const bridge = require('../../../../bridge');
|
|
|
|
// ### 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;
|
|
// make ghost api version available for the theme + routing
|
|
res.locals.apiVersion = bridge.getFrontendApiVersion();
|
|
|
|
next();
|
|
};
|