I'm currently working on a node js / react api, i had the "No 'Access-Control-Allow-Origin'" error and fixed it. My code currently look like this :
app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', 'http://localhost:8888');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
res.setHeader('Access-Control-Allow-Credentials', true);
next();});
Now i would like to authorize access to every domain, everybody whose connected can do the GET, POST... request, how could i do that ?
via Romain
No comments:
Post a Comment