From e0719a2d385aa40d66329153c4de481edf222ad3 Mon Sep 17 00:00:00 2001 From: BARDET Brian <brian.bardet0012@gmail.com> Date: Tue, 26 Jan 2021 10:49:38 +0100 Subject: [PATCH] =?UTF-8?q?Probl=C3=A8me=20avec=20les=20CORS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/server.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/server.js b/api/server.js index bb6a3fc90..186b004d8 100644 --- a/api/server.js +++ b/api/server.js @@ -30,7 +30,11 @@ wss.on('connection', function (ws) { }) app.use(express.json()); - +app.use(function(req, res, next) { + res.header("Access-Control-Allow-Origin", "*"); + res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); + next(); +}); app.get('/', function (req, res) { // res.send('OK') res.sendFile('./index.html', { root: '.' }) -- GitLab