r/programminghelp • • Nov 19 '23
Answered CORS error
I have an Angular application made in intelliJ which runs on localhost:4200
I have a separate Spring API which runs on localhost:8080.
When a I make a request in angular to the Spring API I get a CORS error.
How do I fix this?
Or would It be better to make the Angular application use Spring as the backend so everything runs on port 8080. If so, how do I make angular project on Spring?!<
1
Upvotes
View all comments
Show parent comment
1
u/[deleted] Nov 19 '23
Yes I tried all different things like applying @crossorogin annotations and making a web-config class etc. I ended up having to watch a 2hr YouTube video on someone making a spring and angular app and around the middle he added CORS configuration to the Application.java. It was a big chunk of code that I copied and pasted and now it works :).