From 40f0d6892c25444ec47e79bed2d6cdf90f89cedb Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 10 Jun 2022 14:07:31 +0200 Subject: [PATCH] feat(server): return header with salix-version --- loopback/server/middleware.json | 3 ++- loopback/server/middleware/salix-version.js | 9 +++++++++ package.json | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 loopback/server/middleware/salix-version.js diff --git a/loopback/server/middleware.json b/loopback/server/middleware.json index 60bedcdb3..d65b8b34a 100644 --- a/loopback/server/middleware.json +++ b/loopback/server/middleware.json @@ -31,7 +31,8 @@ "loopback#token": {} }, "auth:after": { - "./middleware/current-user": {} + "./middleware/current-user": {}, + "./middleware/salix-version": {} }, "parse": { "body-parser#json":{} diff --git a/loopback/server/middleware/salix-version.js b/loopback/server/middleware/salix-version.js new file mode 100644 index 000000000..def8e99ef --- /dev/null +++ b/loopback/server/middleware/salix-version.js @@ -0,0 +1,9 @@ + +module.exports = function(options) { + return function(req, res, next) { + const packageJson = require('../../../package.json'); + + res.header('Salix-Version', packageJson.version); + next(); + }; +}; diff --git a/package.json b/package.json index a10e445ed..cb66a79a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "1.0.0", + "version": "6.8.0", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0",