Skip to content

Commit 066d97d

Browse files
authored
fix: Catch router errors (#21)
* Use outdent for templates * Refactor to use the common server engine * Catch router errors * Minor cleanup * More comments * Remove unused import * Handle error in zone instead of wrapping the module * Fix outdent import * Move outdent to prod deps * Support custom status codes * Demo 404 routing * Fix required modules to be prod deps * Support query parameters * Show path on not found page * Removed unused import * Bring back check for express engine * Move routing examples into example project * Fix type issues with zone.js * Fix protocol in url * Add a netlify.toml
1 parent 2a2738b commit 066d97d

33 files changed

+30806
-2806
lines changed

.gitignore

-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
### Node ###
22

3-
# Demo
4-
/demo/netlify
5-
/demo/serverless.ts
6-
/demo/tsconfig.serverless.json
7-
/demo/_redirects
8-
/demo/node_modules
9-
103
# Logs
114
logs
125
*.log

demo/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/netlify
2+
/serverless.ts
3+
/tsconfig.serverless.json
4+
/_redirects
5+
/node_modules
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
17+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

examples/advanced-routing/.gitignore

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
# Only exists if Bazel was run
8+
/bazel-out
9+
10+
# dependencies
11+
/node_modules
12+
13+
# profiling files
14+
chrome-profiler-events*.json
15+
16+
# IDEs and editors
17+
/.idea
18+
.project
19+
.classpath
20+
.c9/
21+
*.launch
22+
.settings/
23+
*.sublime-workspace
24+
25+
# IDE - VSCode
26+
.vscode/*
27+
!.vscode/settings.json
28+
!.vscode/tasks.json
29+
!.vscode/launch.json
30+
!.vscode/extensions.json
31+
.history/*
32+
33+
# misc
34+
/.sass-cache
35+
/connect.lock
36+
/coverage
37+
/libpeerconnection.log
38+
npm-debug.log
39+
yarn-error.log
40+
testem.log
41+
/typings
42+
43+
# System Files
44+
.DS_Store
45+
Thumbs.db
46+
47+
# Netlify
48+
/netlify
49+
/serverless.ts
50+
/tsconfig.serverless.json
51+
/_redirects

examples/advanced-routing/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Advanced Routing Example
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.1.3.
4+
5+
These steps have been run for setting it up:
6+
7+
```sh
8+
ng new angular-tour-of-heroes --minimal
9+
ng generate universal
10+
```
11+
12+
These parts have been added afterwards to demo advanced routing:
13+
- `src/app/express-redirect-platform-location.service.ts`
14+
- `src/app/not-found/`
+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"angular-tour-of-heroes": {
7+
"projectType": "application",
8+
"schematics": {
9+
"@schematics/angular:component": {
10+
"inlineTemplate": true,
11+
"inlineStyle": true,
12+
"skipTests": true
13+
},
14+
"@schematics/angular:class": {
15+
"skipTests": true
16+
},
17+
"@schematics/angular:directive": {
18+
"skipTests": true
19+
},
20+
"@schematics/angular:guard": {
21+
"skipTests": true
22+
},
23+
"@schematics/angular:interceptor": {
24+
"skipTests": true
25+
},
26+
"@schematics/angular:pipe": {
27+
"skipTests": true
28+
},
29+
"@schematics/angular:service": {
30+
"skipTests": true
31+
},
32+
"@schematics/angular:application": {
33+
"strict": true
34+
}
35+
},
36+
"root": "",
37+
"sourceRoot": "src",
38+
"prefix": "app",
39+
"architect": {
40+
"build": {
41+
"builder": "@angular-devkit/build-angular:browser",
42+
"options": {
43+
"outputPath": "dist/angular-tour-of-heroes/browser",
44+
"index": "src/index.html",
45+
"main": "src/main.ts",
46+
"polyfills": "src/polyfills.ts",
47+
"tsConfig": "tsconfig.app.json",
48+
"assets": [
49+
"src/favicon.ico",
50+
"src/assets"
51+
],
52+
"styles": [
53+
"src/styles.css"
54+
],
55+
"scripts": []
56+
},
57+
"configurations": {
58+
"production": {
59+
"budgets": [
60+
{
61+
"type": "initial",
62+
"maximumWarning": "500kb",
63+
"maximumError": "1mb"
64+
},
65+
{
66+
"type": "anyComponentStyle",
67+
"maximumWarning": "2kb",
68+
"maximumError": "4kb"
69+
}
70+
],
71+
"fileReplacements": [
72+
{
73+
"replace": "src/environments/environment.ts",
74+
"with": "src/environments/environment.prod.ts"
75+
}
76+
],
77+
"outputHashing": "all"
78+
},
79+
"development": {
80+
"buildOptimizer": false,
81+
"optimization": false,
82+
"vendorChunk": true,
83+
"extractLicenses": false,
84+
"sourceMap": true,
85+
"namedChunks": true
86+
}
87+
},
88+
"defaultConfiguration": "production"
89+
},
90+
"serve": {
91+
"builder": "@angular-devkit/build-angular:dev-server",
92+
"configurations": {
93+
"production": {
94+
"browserTarget": "angular-tour-of-heroes:build:production"
95+
},
96+
"development": {
97+
"browserTarget": "angular-tour-of-heroes:build:development"
98+
}
99+
},
100+
"defaultConfiguration": "development"
101+
},
102+
"extract-i18n": {
103+
"builder": "@angular-devkit/build-angular:extract-i18n",
104+
"options": {
105+
"browserTarget": "angular-tour-of-heroes:build"
106+
}
107+
},
108+
"server": {
109+
"builder": "@angular-devkit/build-angular:server",
110+
"options": {
111+
"outputPath": "dist/angular-tour-of-heroes/server",
112+
"main": "src/main.server.ts",
113+
"tsConfig": "tsconfig.server.json"
114+
},
115+
"configurations": {
116+
"production": {
117+
"outputHashing": "media",
118+
"fileReplacements": [
119+
{
120+
"replace": "src/environments/environment.ts",
121+
"with": "src/environments/environment.prod.ts"
122+
}
123+
]
124+
},
125+
"development": {
126+
"optimization": false,
127+
"sourceMap": true,
128+
"extractLicenses": false
129+
}
130+
},
131+
"defaultConfiguration": "production"
132+
}
133+
}
134+
}
135+
},
136+
"defaultProject": "angular-tour-of-heroes"
137+
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build]
2+
command = "ng build --configuration production && ng run angular-bfdx:serverless:production"
3+
functions = "netlify/functions"
4+
publish = "dist/angular-bfdx/browser"
5+
6+
[[plugins]]
7+
package = "../.."

0 commit comments

Comments
 (0)