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