【发布时间】:2017-01-03 04:50:19
【问题描述】:
我正在为我的 angular2 项目使用 angular-cli。
我正在通过我的 angular2 服务调用后端 ajax 服务。
对于不同的任务,我有不同的服务端点 (URL)。 我想让这些服务环境变得有意义。
假设我有两个服务
- 客服:
https://localhost:8080/customers - 产品服务:
https://localhost:8080/products
因为localhost 在我的开发环境中可用。它正在工作
现在假设 x.x.x.x 是我的生产 Web 服务主机 IP 地址。
所以对于生产环境,服务 URL 将是 https://x.x.x.x:8080/customers
请帮助我如何实现这一目标。
我发现 angular-cli.json 文件中有一个块
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
但我现在确实找到了那个环境目录。
如何创建和管理特定于环境的端点?
【问题讨论】:
标签: angular angular-cli