Answer the question
In order to leave comments, you need to log in
Error setting response headers?
There is a module that disables cors
// cors-headers
module.exports = (request, response, next) => {
response.set({
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'DELETE,GET,PATCH,POST,PUT',
'Access-Control-Allow-Headers': 'Content-Type,Authorization,origin,accept'
});
next();
};
const express = require('express');
const corsHeaders = require('./middleware/cors-headers');
const app = express();
app.use(corsHeaders);
// .. app.get(), app.post() ...
response.send(data)
, a warning appears: Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question