N
N
Night_Harpy2021-02-11 23:57:04
Node.js
Night_Harpy, 2021-02-11 23:57:04

Where to put 'Access-Control-Allow-Origin', '*' in node js?

Making a request from localhost:3000 to localhost:4200 gives an error with the CORS policy. Googled that it is necessary to insert 'Access-Control-Allow-Origin', '*' into the response response, but where exactly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2021-02-12
@Night_Harpy

If you are using express.js, judging by the tags, it is best to do this through the middleware: https://expressjs.com/en/resources/middleware/cors.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question