mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 10:33:43 +08:00
docs(@angular/cli): adds multiple entries how-to
If there is a need to define multiple entries or otherwise more complex configuration a js file can be used to configure the proxy. These changes document how to do so.
This commit is contained in:
parent
e87598e5db
commit
4008768f86
@ -26,3 +26,33 @@ and then we edit the `package.json` file's start script to be
|
||||
```
|
||||
|
||||
now run it with `npm start`
|
||||
|
||||
### Multiple entries
|
||||
|
||||
If you need to proxy multiple entries to the same target define the configuration in `proxy.conf.js` e.g.
|
||||
|
||||
```js
|
||||
const PROXY_CONFIG = [
|
||||
{
|
||||
context: [
|
||||
"/my",
|
||||
"/many",
|
||||
"/endpoints",
|
||||
"/i",
|
||||
"/need",
|
||||
"/to",
|
||||
"/proxy"
|
||||
],
|
||||
target: "http://localhost:3000",
|
||||
secure: false
|
||||
}
|
||||
]
|
||||
|
||||
module.exports = PROXY_CONFIG;
|
||||
```
|
||||
|
||||
and make sure to point to the right file
|
||||
|
||||
```json
|
||||
"start": "ng serve --proxy-config proxy.conf.js",
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user