Replies: 3 comments
-
In your server-side code, why do you attach what happens if you do something like this? const cors = require('cors')
// other declarations
app.use(cors())
// other middlewares
app.post('/data', async (req, res) => {
// other logic
}) |
Beta Was this translation helpful? Give feedback.
-
@am-a-man Going through the Network tab in the browser dev tools might give a better idea of the HTTP headers of the options pre-flight request. |
Beta Was this translation helpful? Give feedback.
-
You should put all the request methods in an array. |
Beta Was this translation helpful? Give feedback.
-
I wrote a simple API for learning using express, when I try to send a POST request from POSTMAN it is carried out and returns a success message but when POST is sent from client, PreFlight is issued and POST request after being stalled gets cancelled, after which PreFlight does return "204 No Content" success message.
my client side code is:
and the server POST request handler is:
Beta Was this translation helpful? Give feedback.
All reactions