Skip to content

Commit 2ef27c8

Browse files
authored
allow local admin dashboard (#212)
* allow local admin dashboard * removed 'unused' constant...
1 parent 75189d1 commit 2ef27c8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

server/api/AdminAPI.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@ const debugMode = Array.from(process.argv.map((arg) => arg.trim().toLowerCase())
44
const logger = require('../modules/Logger')(debugMode);
55
const eventManager = (require('../modules/singletons/EventManager.js')).instance;
66
const cors = require('cors');
7-
const { CORS_OPTIONS, CONTENT_TYPE_VALIDATOR } = require('../config/globals');
7+
const { CONTENT_TYPE_VALIDATOR } = require('../config/globals');
88

9-
router.use(cors(CORS_OPTIONS));
9+
router.use(cors(
10+
(process.env.NODE_ENV?.trim() === 'development'
11+
? {
12+
origin: '*',
13+
optionsSuccessStatus: 200
14+
}
15+
: {
16+
origin: 'http://localhost:3000',
17+
optionsSuccessStatus: 200
18+
})
19+
));
1020

1121
router.post('/sockets/broadcast', (req, res, next) => {
1222
CONTENT_TYPE_VALIDATOR(req, res, next);

0 commit comments

Comments
 (0)