简体   繁体   中英

nrwl nx angular build api endpoint

Im having a problem with the urls on my build I have an angular and nest project, serving locally, works fine. I can fetch data from the server without problems. But when I run the angular build, the API url is wrong (http://localhost/api/todos) my API in this case is in localhost:3333. I tried to replace the proxy with this in the angular.json

{
"replace": "apps/front/proxy.conf.json",
 with": "apps/front/proxy-prod.conf.json"
 } 

I need to have the url to the api endpoint on the server (http://myServer/API), maybe Im missing something in the configuration

does proxy.prod.json file exist? by default this configuration comes only in the "serve" target, if you want it in the build you need to configure it. however, it is not recommended, this is only for development, in production the server must have CORS configured

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM