Fix placement

This commit is contained in:
Moe Poi ~ 2022-05-13 11:58:35 +07:00
parent 20ac25478d
commit 8d7b0d4628

View file

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