mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
4332546a56
refs: https://github.com/TryGhost/Toolbox/issues/228 - we are getting rid of the concept of api versions from Ghost - this means getting rid of them from the frontend as well, and from themes
18 lines
619 B
JavaScript
18 lines
619 B
JavaScript
const ghostVersion = require('@tryghost/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;
|
|
// @TODO: remove
|
|
res.locals.apiVersion = 'canary';
|
|
|
|
next();
|
|
};
|