├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── browserslist ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── server.ts ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.html │ ├── app.component.scss │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── app.server.module.ts │ ├── dashboard │ │ ├── dashboard.component.html │ │ ├── dashboard.component.scss │ │ └── dashboard.component.ts │ ├── details │ │ ├── details.component.html │ │ ├── details.component.scss │ │ └── details.component.ts │ ├── imprint │ │ ├── imprint.component.html │ │ ├── imprint.component.scss │ │ ├── imprint.component.spec.ts │ │ └── imprint.component.ts │ ├── info │ │ ├── info.component.html │ │ ├── info.component.scss │ │ ├── info.component.spec.ts │ │ └── info.component.ts │ ├── pizza │ │ ├── pizza.component.html │ │ ├── pizza.component.scss │ │ └── pizza.component.ts │ └── shared │ │ ├── pizza.service.ts │ │ ├── pizza.ts │ │ ├── repeat.directive.spec.ts │ │ └── repeat.directive.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.server.ts ├── main.ts ├── polyfills.ts ├── styles.scss └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.server.json ├── tsconfig.spec.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 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 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Playground for SSR and Prerendering with Angular 2 | 3 | ### Installing and building 4 | 5 | Install all dependencies as usual. 6 | Just to make sure everything is fine, run the project locally: 7 | 8 | ```bash 9 | npm install 10 | ng serve 11 | ``` 12 | 13 | If you want, you can take a look at the HTML source code in the browser. It should show the typical `index.html` skeleton with an almost empty `` element. 14 | 15 | We then need separate builds for client and server. 16 | 17 | ```bash 18 | # Client 19 | ng build --prod 20 | 21 | # Server 22 | ng run ssr-playground:server:production 23 | 24 | 25 | # OR both together 26 | npm run build:ssr 27 | ``` 28 | 29 | You should now find a `dist` folder with two sub-directories: 30 | 31 | ``` 32 | - dist 33 | - ssr-playground 34 | - browser 35 | - server 36 | ``` 37 | 38 | We can take a look at the server now! 39 | 40 | ### Compiling the server for SSR 41 | 42 | The server part is a TypeScript program for Node.js in the `server.ts` file. 43 | It is already bundled with the application in `dist/ssr-playground/server/main.js` after running `npm run build:ssr`. 44 | 45 | 46 | ### Running Server-side rendering 47 | 48 | Run the Express server with live server-side rendering: 49 | 50 | ```bash 51 | node dist/ssr-playground/server/main 52 | # OR 53 | npm run serve:ssr 54 | ``` 55 | 56 | Open your browser at [http://localhost:4000](http://localhost:4000) to see it in action. When you show the source code in the browser you should see the server-side rendered HTML. 57 | 58 | 59 | #### Pre-rendering 60 | 61 | 62 | ```bash 63 | npm run prerender 64 | ``` 65 | 66 | You should now find some subfolders in the `dist/browser` directory, according to the routes of the application. 67 | Run a local web server there, e.g. `angular-http-server` or `http-server`: 68 | 69 | ```bash 70 | cd dist/ssr-playground/browser 71 | npx http-server 72 | ``` 73 | 74 | Open your browser at [http://localhost:8080](http://localhost:8080). 75 | This should be blazing fast because it just shows the prerendered pages without doing any rendering at runtime. 76 | The Angular application bundles will kick in later and take over the static page. 77 | 78 | 79 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ssr-playground": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/ssr-playground/browser", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "aot": true, 26 | "assets": [ 27 | "src/favicon.ico", 28 | "src/assets" 29 | ], 30 | "styles": [ 31 | "src/styles.scss" 32 | ], 33 | "scripts": [] 34 | }, 35 | "configurations": { 36 | "production": { 37 | "fileReplacements": [ 38 | { 39 | "replace": "src/environments/environment.ts", 40 | "with": "src/environments/environment.prod.ts" 41 | } 42 | ], 43 | "optimization": true, 44 | "outputHashing": "all", 45 | "sourceMap": false, 46 | "extractCss": true, 47 | "namedChunks": false, 48 | "extractLicenses": true, 49 | "vendorChunk": false, 50 | "buildOptimizer": true, 51 | "budgets": [ 52 | { 53 | "type": "initial", 54 | "maximumWarning": "2mb", 55 | "maximumError": "5mb" 56 | }, 57 | { 58 | "type": "anyComponentStyle", 59 | "maximumWarning": "6kb", 60 | "maximumError": "10kb" 61 | } 62 | ] 63 | } 64 | } 65 | }, 66 | "serve": { 67 | "builder": "@angular-devkit/build-angular:dev-server", 68 | "options": { 69 | "browserTarget": "ssr-playground:build" 70 | }, 71 | "configurations": { 72 | "production": { 73 | "browserTarget": "ssr-playground:build:production" 74 | } 75 | } 76 | }, 77 | "extract-i18n": { 78 | "builder": "@angular-devkit/build-angular:extract-i18n", 79 | "options": { 80 | "browserTarget": "ssr-playground:build" 81 | } 82 | }, 83 | "test": { 84 | "builder": "@angular-devkit/build-angular:karma", 85 | "options": { 86 | "main": "src/test.ts", 87 | "polyfills": "src/polyfills.ts", 88 | "tsConfig": "tsconfig.spec.json", 89 | "karmaConfig": "karma.conf.js", 90 | "assets": [ 91 | "src/favicon.ico", 92 | "src/assets" 93 | ], 94 | "styles": [ 95 | "src/styles.scss" 96 | ], 97 | "scripts": [] 98 | } 99 | }, 100 | "lint": { 101 | "builder": "@angular-devkit/build-angular:tslint", 102 | "options": { 103 | "tsConfig": [ 104 | "tsconfig.app.json", 105 | "tsconfig.spec.json", 106 | "e2e/tsconfig.json" 107 | ], 108 | "exclude": [ 109 | "**/node_modules/**" 110 | ] 111 | } 112 | }, 113 | "e2e": { 114 | "builder": "@angular-devkit/build-angular:protractor", 115 | "options": { 116 | "protractorConfig": "e2e/protractor.conf.js", 117 | "devServerTarget": "ssr-playground:serve" 118 | }, 119 | "configurations": { 120 | "production": { 121 | "devServerTarget": "ssr-playground:serve:production" 122 | } 123 | } 124 | }, 125 | "server": { 126 | "builder": "@angular-devkit/build-angular:server", 127 | "options": { 128 | "outputPath": "dist/ssr-playground/server", 129 | "main": "server.ts", 130 | "tsConfig": "tsconfig.server.json" 131 | }, 132 | "configurations": { 133 | "production": { 134 | "outputHashing": "media", 135 | "fileReplacements": [ 136 | { 137 | "replace": "src/environments/environment.ts", 138 | "with": "src/environments/environment.prod.ts" 139 | } 140 | ], 141 | "sourceMap": false, 142 | "optimization": true 143 | } 144 | } 145 | }, 146 | "serve-ssr": { 147 | "builder": "@nguniversal/builders:ssr-dev-server", 148 | "options": { 149 | "browserTarget": "ssr-playground:build", 150 | "serverTarget": "ssr-playground:server" 151 | }, 152 | "configurations": { 153 | "production": { 154 | "browserTarget": "ssr-playground:build:production", 155 | "serverTarget": "ssr-playground:server:production" 156 | } 157 | } 158 | }, 159 | "prerender": { 160 | "builder": "@nguniversal/builders:prerender", 161 | "options": { 162 | "browserTarget": "ssr-playground:build:production", 163 | "serverTarget": "ssr-playground:server:production", 164 | "routes": [ 165 | "/", 166 | "/dashboard", 167 | "/imprint", 168 | "/info", 169 | "/pizza/1", 170 | "/pizza/2", 171 | "/pizza/3", 172 | "/pizza/4", 173 | "/pizza/5", 174 | "/pizza/6", 175 | "/pizza/7" 176 | ] 177 | }, 178 | "configurations": { 179 | "production": {} 180 | } 181 | }, 182 | "deploy": { 183 | "builder": "angular-cli-ghpages:deploy", 184 | "options": { 185 | "noBuild": true, 186 | "cname": "ssrpizza.schnell-mal.de" 187 | } 188 | } 189 | } 190 | } 191 | }, 192 | "defaultProject": "ssr-playground" 193 | } 194 | -------------------------------------------------------------------------------- /browserslist: -------------------------------------------------------------------------------- 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 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 31 | } 32 | }; -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('ssr-playground app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo(): Promise { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/ssr-playground'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ssr-playground", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e", 11 | "dev:ssr": "ng run ssr-playground:serve-ssr", 12 | "serve:ssr": "node dist/ssr-playground/server/main.js", 13 | "build:ssr": "ng build --prod && ng run ssr-playground:server:production", 14 | "prerender": "ng run ssr-playground:prerender", 15 | "deploy": "npm run prerender && ng deploy" 16 | }, 17 | "private": true, 18 | "dependencies": { 19 | "@angular/animations": "~9.0.3", 20 | "@angular/common": "~9.0.3", 21 | "@angular/compiler": "~9.0.3", 22 | "@angular/core": "~9.0.3", 23 | "@angular/forms": "~9.0.3", 24 | "@angular/platform-browser": "~9.0.3", 25 | "@angular/platform-browser-dynamic": "~9.0.3", 26 | "@angular/platform-server": "~9.0.3", 27 | "@angular/router": "~9.0.3", 28 | "@nguniversal/express-engine": "^9.0.1", 29 | "express": "^4.15.2", 30 | "rxjs": "~6.5.4", 31 | "tslib": "^1.10.0", 32 | "zone.js": "~0.10.2" 33 | }, 34 | "devDependencies": { 35 | "@angular-devkit/build-angular": "~0.900.4", 36 | "@angular/cli": "~9.0.4", 37 | "@angular/compiler-cli": "~9.0.3", 38 | "@angular/language-service": "~9.0.3", 39 | "@nguniversal/builders": "^9.0.1", 40 | "@types/express": "^4.17.0", 41 | "@types/jasmine": "~3.5.0", 42 | "@types/jasminewd2": "~2.0.3", 43 | "@types/node": "^12.11.1", 44 | "angular-cli-ghpages": "^0.6.2", 45 | "codelyzer": "^5.1.2", 46 | "jasmine-core": "~3.5.0", 47 | "jasmine-spec-reporter": "~4.2.1", 48 | "karma": "~4.3.0", 49 | "karma-chrome-launcher": "~3.1.0", 50 | "karma-coverage-istanbul-reporter": "~2.1.0", 51 | "karma-jasmine": "~2.0.1", 52 | "karma-jasmine-html-reporter": "^1.4.2", 53 | "protractor": "~5.4.3", 54 | "ts-node": "~8.3.0", 55 | "tslint": "~5.18.0", 56 | "typescript": "~3.7.5" 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /server.ts: -------------------------------------------------------------------------------- 1 | import 'zone.js/dist/zone-node'; 2 | 3 | import { ngExpressEngine } from '@nguniversal/express-engine'; 4 | import * as express from 'express'; 5 | import { join } from 'path'; 6 | 7 | import { AppServerModule } from './src/main.server'; 8 | import { APP_BASE_HREF } from '@angular/common'; 9 | import { existsSync } from 'fs'; 10 | 11 | // The Express app is exported so that it can be used by serverless Functions. 12 | export function app() { 13 | const server = express(); 14 | const distFolder = join(process.cwd(), 'dist/ssr-playground/browser'); 15 | const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index'; 16 | 17 | // Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine) 18 | server.engine('html', ngExpressEngine({ 19 | bootstrap: AppServerModule, 20 | })); 21 | 22 | server.set('view engine', 'html'); 23 | server.set('views', distFolder); 24 | 25 | // Example Express Rest API endpoints 26 | // app.get('/api/**', (req, res) => { }); 27 | // Serve static files from /browser 28 | server.get('*.*', express.static(distFolder, { 29 | maxAge: '1y' 30 | })); 31 | 32 | // All regular routes use the Universal engine 33 | server.get('*', (req, res) => { 34 | res.render(indexHtml, { req, providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }] }); 35 | }); 36 | 37 | return server; 38 | } 39 | 40 | function run() { 41 | const port = process.env.PORT || 4000; 42 | 43 | // Start up the Node server 44 | const server = app(); 45 | server.listen(port, () => { 46 | console.log(`Node Express server listening on http://localhost:${port}`); 47 | }); 48 | } 49 | 50 | // Webpack will replace 'require' with '__webpack_require__' 51 | // '__non_webpack_require__' is a proxy to Node 'require' 52 | // The below code is to ensure that the server is run only when not requiring the bundle. 53 | declare const __non_webpack_require__: NodeRequire; 54 | const mainModule = __non_webpack_require__.main; 55 | const moduleFilename = mainModule && mainModule.filename || ''; 56 | if (moduleFilename === __filename || moduleFilename.includes('iisnode')) { 57 | run(); 58 | } 59 | 60 | export * from './src/main.server'; 61 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { DashboardComponent } from './dashboard/dashboard.component'; 5 | import { DetailsComponent } from './details/details.component'; 6 | import { InfoComponent } from './info/info.component'; 7 | import { ImprintComponent } from './imprint/imprint.component'; 8 | 9 | const routes: Routes = [ 10 | { path: '', redirectTo: 'dashboard', pathMatch: 'full' }, 11 | { path: 'dashboard', component: DashboardComponent }, 12 | { path: 'pizza/:id', component: DetailsComponent }, 13 | { path: 'info', component: InfoComponent }, 14 | { path: 'imprint', component: ImprintComponent }, 15 | ]; 16 | 17 | @NgModule({ 18 | imports: [RouterModule.forRoot(routes, { 19 | initialNavigation: 'enabled' 20 | })], 21 | exports: [RouterModule] 22 | }) 23 | export class AppRoutingModule { } 24 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | 🍕 Pizza Service 4 |

5 | 6 | 10 |
11 | 12 |
13 | 14 |
15 | -------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | header { 2 | display: block; 3 | -webkit-box-shadow: 0px 0px 15px 0px rgba(0,0,0,0.22); 4 | -moz-box-shadow: 0px 0px 15px 0px rgba(0,0,0,0.22); 5 | box-shadow: 0px 0px 15px 0px rgba(0,0,0,0.22); 6 | padding: 1em; 7 | 8 | h1 { 9 | margin: 0; 10 | font-size: 2.5rem; 11 | a { 12 | color: inherit; 13 | text-decoration: inherit; 14 | } 15 | } 16 | 17 | .links { 18 | position: absolute; 19 | right: 2em; 20 | top: 2.1em; 21 | 22 | a { 23 | margin-left: 2em; 24 | font-weight: bold; 25 | text-decoration: none; 26 | color: black; 27 | 28 | &:hover { 29 | text-decoration: underline; 30 | } 31 | } 32 | } 33 | } 34 | 35 | .container { 36 | padding: 1em; 37 | } 38 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async(() => { 7 | TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | })); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'ssr-playground'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('ssr-playground'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement; 33 | expect(compiled.querySelector('.content span').textContent).toContain('ssr-playground app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'] 7 | }) 8 | export class AppComponent { 9 | title = 'ssr-playground'; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule, LOCALE_ID } from '@angular/core'; 3 | import { HttpClientModule } from '@angular/common/http'; 4 | import { registerLocaleData } from '@angular/common'; 5 | import localeDe from '@angular/common/locales/de'; 6 | 7 | import { AppRoutingModule } from './app-routing.module'; 8 | import { AppComponent } from './app.component'; 9 | import { PizzaComponent } from './pizza/pizza.component'; 10 | import { DashboardComponent } from './dashboard/dashboard.component'; 11 | import { DetailsComponent } from './details/details.component'; 12 | import { NgForRepeat } from './shared/repeat.directive'; 13 | import { ImprintComponent } from './imprint/imprint.component'; 14 | import { InfoComponent } from './info/info.component'; 15 | 16 | @NgModule({ 17 | declarations: [ 18 | AppComponent, 19 | PizzaComponent, 20 | DashboardComponent, 21 | DetailsComponent, 22 | NgForRepeat, 23 | ImprintComponent, 24 | InfoComponent 25 | ], 26 | imports: [ 27 | BrowserModule.withServerTransition({ appId: 'serverApp' }), 28 | AppRoutingModule, 29 | HttpClientModule 30 | ], 31 | providers: [ 32 | { provide: LOCALE_ID, useValue: 'de' } 33 | ], 34 | bootstrap: [AppComponent] 35 | }) 36 | export class AppModule { 37 | constructor() { 38 | registerLocaleData(localeDe); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/app/app.server.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { ServerModule } from '@angular/platform-server'; 3 | 4 | import { AppModule } from './app.module'; 5 | import { AppComponent } from './app.component'; 6 | 7 | @NgModule({ 8 | imports: [ 9 | AppModule, 10 | ServerModule, 11 | ], 12 | bootstrap: [AppComponent], 13 | }) 14 | export class AppServerModule {} 15 | -------------------------------------------------------------------------------- /src/app/dashboard/dashboard.component.html: -------------------------------------------------------------------------------- 1 |

2 | This app is running on the {{ platform }} platform. 3 |

4 | 5 |
6 | 7 |
8 | -------------------------------------------------------------------------------- /src/app/dashboard/dashboard.component.scss: -------------------------------------------------------------------------------- 1 | .container { 2 | display: flex; 3 | justify-content: flex-start; 4 | flex-wrap: wrap; 5 | } 6 | -------------------------------------------------------------------------------- /src/app/dashboard/dashboard.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Inject, PLATFORM_ID } from '@angular/core'; 2 | import { Observable } from 'rxjs'; 3 | import { isPlatformBrowser, isPlatformServer } from '@angular/common'; 4 | import { PizzaService } from '../shared/pizza.service'; 5 | import { Pizza } from '../shared/pizza'; 6 | 7 | @Component({ 8 | selector: 'app-dashboard', 9 | templateUrl: './dashboard.component.html', 10 | styleUrls: ['./dashboard.component.scss'] 11 | }) 12 | export class DashboardComponent implements OnInit { 13 | 14 | pizzas$: Observable; 15 | platform: string; 16 | 17 | constructor(private ps: PizzaService, @Inject(PLATFORM_ID) private platformId: object) { } 18 | 19 | ngOnInit() { 20 | this.pizzas$ = this.ps.getAll(); 21 | 22 | if (isPlatformBrowser(this.platformId)) { 23 | this.platform = '💻 browser'; 24 | } else if (isPlatformServer(this.platformId)) { 25 | this.platform = '⚙️ server'; 26 | } else { 27 | this.platform = 'unknown'; 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/app/details/details.component.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | {{ pizza.name }} 4 | ⭐️ 5 |

6 | 7 |

8 | {{ pizza.description }} 9 |

10 | 11 |
{{ pizza.price | currency:'EUR' }}
12 |
13 | 14 | 15 | Back to dashboard 16 | -------------------------------------------------------------------------------- /src/app/details/details.component.scss: -------------------------------------------------------------------------------- 1 | :host { 2 | display: block; 3 | } 4 | 5 | .price { 6 | font-size: 1.5em; 7 | margin-bottom: 2em; 8 | } 9 | -------------------------------------------------------------------------------- /src/app/details/details.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { Pizza } from '../shared/pizza'; 4 | import { Observable } from 'rxjs'; 5 | import { map, switchMap } from 'rxjs/operators'; 6 | import { PizzaService } from '../shared/pizza.service'; 7 | 8 | 9 | @Component({ 10 | selector: 'app-details', 11 | templateUrl: './details.component.html', 12 | styleUrls: ['./details.component.scss'] 13 | }) 14 | export class DetailsComponent implements OnInit { 15 | 16 | pizza$: Observable; 17 | 18 | constructor(private route: ActivatedRoute, private ps: PizzaService) { } 19 | 20 | ngOnInit() { 21 | this.pizza$ = this.route.paramMap.pipe( 22 | map(params => parseInt(params.get('id'), 10)), 23 | switchMap(id => this.ps.getById(id)) 24 | ); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/app/imprint/imprint.component.html: -------------------------------------------------------------------------------- 1 |

Imprint and legal info

2 | 3 | Lorem ipsum dolor sit amet... 4 | -------------------------------------------------------------------------------- /src/app/imprint/imprint.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-schule/demo-ssr-playground/cecaf16e730cff885887cb05974651a2dbe8f27f/src/app/imprint/imprint.component.scss -------------------------------------------------------------------------------- /src/app/imprint/imprint.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ImprintComponent } from './imprint.component'; 4 | 5 | describe('ImprintComponent', () => { 6 | let component: ImprintComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ImprintComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ImprintComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/imprint/imprint.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-imprint', 5 | templateUrl: './imprint.component.html', 6 | styleUrls: ['./imprint.component.scss'] 7 | }) 8 | export class ImprintComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/info/info.component.html: -------------------------------------------------------------------------------- 1 |

ℹ️ Info

2 | 3 | This is our super duper pizza app. 4 | It's blazing fast because it uses Server-Side Rendering. 5 | Do you like it? 6 | -------------------------------------------------------------------------------- /src/app/info/info.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-schule/demo-ssr-playground/cecaf16e730cff885887cb05974651a2dbe8f27f/src/app/info/info.component.scss -------------------------------------------------------------------------------- /src/app/info/info.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { InfoComponent } from './info.component'; 4 | 5 | describe('InfoComponent', () => { 6 | let component: InfoComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ InfoComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(InfoComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/info/info.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-info', 5 | templateUrl: './info.component.html', 6 | styleUrls: ['./info.component.scss'] 7 | }) 8 | export class InfoComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/pizza/pizza.component.html: -------------------------------------------------------------------------------- 1 |

🍕 {{ pizza.name }} #{{ pizza.id }}

2 |

{{ pizza.description }}

3 | 4 | Go to details page 5 | 6 | -------------------------------------------------------------------------------- /src/app/pizza/pizza.component.scss: -------------------------------------------------------------------------------- 1 | :host { 2 | display: block; 3 | background: #FAFAFA; 4 | padding: 20px 15px; 5 | border: 1px solid #888; 6 | border-radius: 3px; 7 | width: 400px; 8 | margin: .5em; 9 | } 10 | 11 | h4 { 12 | font-size: 2em; 13 | margin: 0; 14 | padding: 0; 15 | margin-bottom: 10px; 16 | } 17 | -------------------------------------------------------------------------------- /src/app/pizza/pizza.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Pizza } from '../shared/pizza'; 3 | import { Input } from '@angular/core'; 4 | 5 | @Component({ 6 | selector: 'app-pizza', 7 | templateUrl: './pizza.component.html', 8 | styleUrls: ['./pizza.component.scss'] 9 | }) 10 | export class PizzaComponent implements OnInit { 11 | 12 | @Input() pizza: Pizza; 13 | 14 | constructor() { } 15 | 16 | ngOnInit() { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/app/shared/pizza.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, PLATFORM_ID, Inject } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable, of } from 'rxjs'; 4 | 5 | import { Pizza } from './pizza'; 6 | import { isPlatformServer, isPlatformBrowser } from '@angular/common'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class PizzaService { 12 | 13 | private apiUrl = 'https://pizza.angular.schule'; 14 | 15 | constructor(private http: HttpClient, @Inject(PLATFORM_ID) private platformId: object) { } 16 | 17 | getAll(): Observable { 18 | return this.http.get(`${this.apiUrl}/pizzas`); 19 | } 20 | 21 | getById(id: number): Observable { 22 | return this.http.get(`${this.apiUrl}/pizza/${id}`); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/app/shared/pizza.ts: -------------------------------------------------------------------------------- 1 | export interface Pizza { 2 | id: number; 3 | name: string; 4 | description: string; 5 | price: number; 6 | rating: number; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/shared/repeat.directive.spec.ts: -------------------------------------------------------------------------------- 1 | import { RepeatDirective } from './repeat.directive'; 2 | 3 | describe('RepeatDirective', () => { 4 | it('should create an instance', () => { 5 | const directive = new RepeatDirective(); 6 | expect(directive).toBeTruthy(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /src/app/shared/repeat.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive, Input } from '@angular/core'; 2 | import { NgForOf } from '@angular/common'; 3 | 4 | @Directive({ 5 | selector: '[ngFor][ngForRepeat]' 6 | }) 7 | export class NgForRepeat extends NgForOf { 8 | @Input() set ngForRepeat(repeat: number) { 9 | this.ngForOf = new Array(repeat >= 0 ? repeat : 0); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-schule/demo-ssr-playground/cecaf16e730cff885887cb05974651a2dbe8f27f/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-schule/demo-ssr-playground/cecaf16e730cff885887cb05974651a2dbe8f27f/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SsrPlayground 6 | 7 | 8 | 9 | 10 | 11 | Loading... 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main.server.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | 3 | import { environment } from './environments/environment'; 4 | 5 | if (environment.production) { 6 | enableProdMode(); 7 | } 8 | 9 | export { AppServerModule } from './app/app.server.module'; 10 | export { renderModule, renderModuleFactory } from '@angular/platform-server'; 11 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | document.addEventListener('DOMContentLoaded', () => { 12 | platformBrowserDynamic().bootstrapModule(AppModule) 13 | .catch(err => console.error(err)); 14 | }); 15 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body { 3 | font-family: Arial, Helvetica; 4 | padding: 0; 5 | margin: 0; 6 | } 7 | 8 | $btncol: rgb(193, 4, 4); 9 | 10 | a.btn { 11 | border-radius: 5px; 12 | background: $btncol; 13 | padding: .6em; 14 | color: white; 15 | text-decoration: none; 16 | font-size: .9em; 17 | 18 | &:hover { 19 | background: lighten($btncol, 3%) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "src/main.ts", 9 | "src/polyfills.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "downlevelIteration": true, 9 | "experimentalDecorators": true, 10 | "module": "esnext", 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ] 21 | }, 22 | "angularCompilerOptions": { 23 | "fullTemplateTypeCheck": true, 24 | "strictInjectionParameters": true 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tsconfig.server.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.app.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app-server", 5 | "module": "commonjs", 6 | "types": [ 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/main.server.ts", 12 | "server.ts" 13 | ], 14 | "angularCompilerOptions": { 15 | "entryModule": "./src/app/app.server.module#AppServerModule" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rules": { 4 | "array-type": false, 5 | "arrow-parens": false, 6 | "deprecation": { 7 | "severity": "warning" 8 | }, 9 | "component-class-suffix": true, 10 | "contextual-lifecycle": true, 11 | "directive-class-suffix": true, 12 | "directive-selector": [ 13 | true, 14 | "attribute", 15 | "app", 16 | "camelCase" 17 | ], 18 | "component-selector": [ 19 | true, 20 | "element", 21 | "app", 22 | "kebab-case" 23 | ], 24 | "import-blacklist": [ 25 | true, 26 | "rxjs/Rx" 27 | ], 28 | "interface-name": false, 29 | "max-classes-per-file": false, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-consecutive-blank-lines": false, 47 | "no-console": [ 48 | true, 49 | "debug", 50 | "info", 51 | "time", 52 | "timeEnd", 53 | "trace" 54 | ], 55 | "no-empty": false, 56 | "no-inferrable-types": [ 57 | true, 58 | "ignore-params" 59 | ], 60 | "no-non-null-assertion": true, 61 | "no-redundant-jsdoc": true, 62 | "no-switch-case-fall-through": true, 63 | "no-var-requires": false, 64 | "object-literal-key-quotes": [ 65 | true, 66 | "as-needed" 67 | ], 68 | "object-literal-sort-keys": false, 69 | "ordered-imports": false, 70 | "quotemark": [ 71 | true, 72 | "single" 73 | ], 74 | "trailing-comma": false, 75 | "no-conflicting-lifecycle": true, 76 | "no-host-metadata-property": true, 77 | "no-input-rename": true, 78 | "no-inputs-metadata-property": true, 79 | "no-output-native": true, 80 | "no-output-on-prefix": true, 81 | "no-output-rename": true, 82 | "no-outputs-metadata-property": true, 83 | "template-banana-in-box": true, 84 | "template-no-negated-async": true, 85 | "use-lifecycle-interface": true, 86 | "use-pipe-transform-interface": true 87 | }, 88 | "rulesDirectory": [ 89 | "codelyzer" 90 | ] 91 | } --------------------------------------------------------------------------------