Move cors middleware to api router
This commit is contained in:
parent
a383785e7c
commit
1bb1a350e0
@ -17,6 +17,8 @@ const QueryController = require('./query_controller');
|
||||
const CopyController = require('./copy_controller');
|
||||
const JobController = require('./job_controller');
|
||||
|
||||
const cors = require('../middlewares/cors');
|
||||
|
||||
module.exports = class ApiRouter {
|
||||
constructor ({ redisPool, metadataBackend, statsClient, dataIngestionLogger }) {
|
||||
const userLimitsServiceOptions = {
|
||||
@ -61,6 +63,8 @@ module.exports = class ApiRouter {
|
||||
route (app) {
|
||||
const apiRouter = router({ mergeParams: true });
|
||||
|
||||
apiRouter.use(cors());
|
||||
|
||||
this.queryController.route(apiRouter);
|
||||
this.copyController.route(apiRouter);
|
||||
this.jobController.route(apiRouter);
|
||||
|
@ -26,8 +26,6 @@ var RedisPool = require('redis-mpool');
|
||||
var cartodbRedis = require('cartodb-redis');
|
||||
const Logger = require('./services/logger');
|
||||
|
||||
var cors = require('./middlewares/cors');
|
||||
|
||||
const ApiRouter = require('./controllers/api-router');
|
||||
var HealthCheckController = require('./controllers/health_check_controller');
|
||||
var VersionController = require('./controllers/version_controller');
|
||||
@ -93,8 +91,6 @@ function App(statsClient) {
|
||||
app.use(global.log4js.connectLogger(global.log4js.getLogger(), _.defaults(loggerOpts, {level:'info'})));
|
||||
}
|
||||
|
||||
app.use(cors());
|
||||
|
||||
// Use step-profiler
|
||||
app.use(function bootstrap$prepareRequestResponse(req, res, next) {
|
||||
res.locals = res.locals || {};
|
||||
|
Loading…
Reference in New Issue
Block a user