ES6 class and middlewares for version controller
This commit is contained in:
parent
ab9a7fd2fa
commit
158f28c8e7
@ -1,18 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var version = {
|
||||
cartodb_sql_api: require(__dirname + '/../../package.json').version
|
||||
const versions = {
|
||||
cartodb_sql_api: require('./../../package.json').version
|
||||
};
|
||||
|
||||
function VersionController() {
|
||||
module.exports = class VersionController {
|
||||
route (app) {
|
||||
app.get(`${global.settings.base_url}/version`, version());
|
||||
}
|
||||
|
||||
VersionController.prototype.route = function (app) {
|
||||
app.get(global.settings.base_url + '/version', this.handleVersion.bind(this));
|
||||
};
|
||||
|
||||
VersionController.prototype.handleVersion = function (req, res) {
|
||||
res.send(version);
|
||||
function version () {
|
||||
return function versionMiddleware (req, res) {
|
||||
res.send(versions);
|
||||
};
|
||||
|
||||
module.exports = VersionController;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user