diff --git a/index.js b/index.js index 13d3477..b2f5245 100644 --- a/index.js +++ b/index.js @@ -26,9 +26,6 @@ app.use(express.json()); app.use(express.urlencoded({ extended: false })); app.use(cookieParser()); -app.use('/', indexRouter); -app.use('/api', api); - app.use(function (req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, HEAD"); @@ -39,6 +36,9 @@ app.use(function (req, res, next) { next(); }); +app.use('/', indexRouter); +app.use('/api', api); + app.listen(config.port, () => { console.log(`Server is running on port : ${config.port}`); });