Create a file like “proxy.json” in your [email protected] projects’ root.
{ "/api": "http://localhost:1337" }
start your development server with:
🍰 $ ng serve –proxy-config proxy.json
All request to
http://localhost:4200/api/v1/endpoint
will now be proxied to
http://localhost:1337/api/v1/endpoint
Pro Tip:
add
"start": "ng serve --proxy-config proxy.json",
to the scripts section inside of your package.json and use the following command for development: ;-)
npm start