Skip to content

Commit eee45cf

Browse files
committed
feat(serve): add example of using custom base-href and proxy config
The example added supports serving the app via http://localhost:4200/monitoring/ui/ Just run `nom start` to serve the app
1 parent 4196c66 commit eee45cf

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"ng": "ng",
88
"reset": "ng init --routing --style=scss",
9-
"start": "ng serve",
9+
"start": "ng serve -open --proxy=proxy.conf.json",
10+
"build": "ng build -bh \"/monitoring/ui/\"",
1011
"lint": "tslint \"src/**/*.ts\" --project src/tsconfig.json --type-check && tslint \"e2e/**/*.ts\" --project e2e/tsconfig.json --type-check",
1112
"test": "ng test",
1213
"pree2e": "webdriver-manager update --standalone false --gecko false",

proxy.conf.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"/monitoring/ui/**": {
3+
"target": "http://localhost:4200/",
4+
"pathRewrite": {
5+
"^/monitoring/ui": ""
6+
}
7+
}
8+
}

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<title>RoutingAngularCli</title>
6-
<base href="/">
6+
<base href="/monitoring/ui/">
77

88
<meta name="viewport" content="width=device-width, initial-scale=1">
99
<link rel="icon" type="image/x-icon" href="favicon.ico">

0 commit comments

Comments
 (0)