Use template string

This commit is contained in:
Daniel García Aubert 2017-12-29 16:19:00 +01:00
parent a00c2b1eef
commit f186e4736b

View File

@ -16,8 +16,10 @@ function NamedMapsAdminController(authApi, templateMaps) {
module.exports = NamedMapsAdminController;
NamedMapsAdminController.prototype.register = function (app) {
const prefix = app.base_url_templated;
app.post(
app.base_url_templated + '/',
`${prefix}/`,
cors(),
userMiddleware,
this.checkContentType('POST', 'POST TEMPLATE'),
@ -26,7 +28,7 @@ NamedMapsAdminController.prototype.register = function (app) {
);
app.put(
app.base_url_templated + '/:template_id',
`${prefix}/:template_id`,
cors(),
userMiddleware,
this.checkContentType('PUT', 'PUT TEMPLATE'),
@ -35,7 +37,7 @@ NamedMapsAdminController.prototype.register = function (app) {
);
app.get(
app.base_url_templated + '/:template_id',
`${prefix}/:template_id`,
cors(),
userMiddleware,
this.authorizedByAPIKey('get', 'GET TEMPLATE'),
@ -43,7 +45,7 @@ NamedMapsAdminController.prototype.register = function (app) {
);
app.delete(
app.base_url_templated + '/:template_id',
`${prefix}/:template_id`,
cors(),
userMiddleware,
this.authorizedByAPIKey('delete', 'DELETE TEMPLATE'),
@ -51,7 +53,7 @@ NamedMapsAdminController.prototype.register = function (app) {
);
app.get(
app.base_url_templated + '/',
`${prefix}/`,
cors(),
userMiddleware,
this.authorizedByAPIKey('list', 'GET TEMPLATE LIST'),
@ -59,7 +61,7 @@ NamedMapsAdminController.prototype.register = function (app) {
);
app.options(
app.base_url_templated + '/:template_id',
`${prefix}/:template_id`,
cors('Content-Type')
);
};