Reputation: 1
I am trying to create CRUD application in this combination Reactjs nodejs express and dynamodb. I am seeing CORS error when using Update and Delete request. However, GET and POST is working. I am using axios. I have added CORS related headers. I am wondering why CORS error is appearing for UPDATE and DELETE?
Upvotes: 0
Views: 168
Reputation: 493
Generally, you don't need to send custom headers to enable CORS. Framework should take care of generating those headers if you mention which hosts to trust or if it needs to enable CORS for all origins.
You can try enabling CORS for all origins like this:
var app = express();
app.use(cors());
Or for a particular domain like this:
app.use(cors({
origin: 'http://yourdomain.com'
}));
Upvotes: 1