This is the error that I had faced before when requesting in localhost, and I solved it using proxy config in Angular.
So as I was using a custom proxy, I had to remove that proxy-config from my Angular app before deploying it in Heroku, because if I don't do this, the deployment app doesn't work.
This is the CORS error:
in postman the localhost request works if I nodemon the node server so I can say there's no error in my api
but if using the request given by heroku in postman I get this html response
tbh I don't know what's going on, because I'm doing a course of Angular and these errors are not supposed to appair, tkank you guys :)
Your web server should allow
corsfor you application.If you server is written with NodeJS, take look at the Cors package
Then In NodeJS project, install it:
Then modify a bit your listener:
Make sure
app.use(cors())to be before any other middleware