CORS whitelist for NodeJS

This commit is contained in:
Thanakorn S
2026-05-27 11:26:40 +07:00
parent 5221b3a1a1
commit 458a883810
+1 -1
View File
@@ -7,7 +7,7 @@ const { Server } = require('socket.io');
const app = express();
const httpServer = createServer(app);
const io = new Server(httpServer, {
cors: { origin: '*' }
cors: { origin: process.env.ALLOWED_ORIGIN || 'http://localhost' }
});
app.use(express.json());