adding middlewares to composer in maps controller
This commit is contained in:
parent
136c6fa70b
commit
dfdd2b9043
@ -57,31 +57,19 @@ MapController.prototype.register = function(app) {
|
||||
|
||||
app.get(
|
||||
base_url_mapconfig,
|
||||
cors(),
|
||||
userMiddleware,
|
||||
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.ANONYMOUS),
|
||||
this.composeCreateMapMiddleware()
|
||||
this.composeCreateMapMiddleware(RATE_LIMIT_ENDPOINTS_GROUPS.ANONYMOUS)
|
||||
);
|
||||
app.post(
|
||||
base_url_mapconfig,
|
||||
cors(),
|
||||
userMiddleware,
|
||||
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.ANONYMOUS),
|
||||
this.composeCreateMapMiddleware()
|
||||
this.composeCreateMapMiddleware(RATE_LIMIT_ENDPOINTS_GROUPS.ANONYMOUS)
|
||||
);
|
||||
app.get(
|
||||
`${base_url_templated}/:template_id/jsonp`,
|
||||
cors(),
|
||||
userMiddleware,
|
||||
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED),
|
||||
this.composeCreateMapMiddleware(useTemplate)
|
||||
this.composeCreateMapMiddleware(RATE_LIMIT_ENDPOINTS_GROUPS.NAMED, useTemplate)
|
||||
);
|
||||
app.post(
|
||||
`${base_url_templated}/:template_id`,
|
||||
cors(),
|
||||
userMiddleware,
|
||||
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED),
|
||||
this.composeCreateMapMiddleware(useTemplate)
|
||||
this.composeCreateMapMiddleware(RATE_LIMIT_ENDPOINTS_GROUPS.NAMED, useTemplate)
|
||||
);
|
||||
app.options(
|
||||
app.base_url_mapconfig,
|
||||
@ -89,7 +77,7 @@ MapController.prototype.register = function(app) {
|
||||
);
|
||||
};
|
||||
|
||||
MapController.prototype.composeCreateMapMiddleware = function (useTemplate = false) {
|
||||
MapController.prototype.composeCreateMapMiddleware = function (endpoint = false, useTemplate = false) {
|
||||
const isTemplateInstantiation = useTemplate;
|
||||
const useTemplateHash = useTemplate;
|
||||
const includeQuery = !useTemplate;
|
||||
@ -97,6 +85,9 @@ MapController.prototype.composeCreateMapMiddleware = function (useTemplate = fal
|
||||
const addContext = !useTemplate;
|
||||
|
||||
return [
|
||||
cors(),
|
||||
userMiddleware,
|
||||
rateLimit(this.userLimitsApi, endpoint),
|
||||
allowQueryParams(['aggregation']),
|
||||
this.prepareContext,
|
||||
this.initProfiler(isTemplateInstantiation),
|
||||
|
Loading…
Reference in New Issue
Block a user