Skip to content

Commit c0efd65

Browse files
initial
1 parent 89239d0 commit c0efd65

22 files changed

+704
-163
lines changed

.angular-cli.json

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
},
66
"apps": [
77
{
8-
"root": "src",
9-
"outDir": "dist",
8+
"root": "client",
9+
"outDir": "dist/client",
1010
"assets": [
1111
"assets",
1212
"favicon.ico"
@@ -27,6 +27,31 @@
2727
"dev": "environments/environment.ts",
2828
"prod": "environments/environment.prod.ts"
2929
}
30+
},
31+
{
32+
"platform": "server",
33+
"root": "client",
34+
"outDir": "dist/server",
35+
"assets": [
36+
"assets",
37+
"favicon.ico"
38+
],
39+
"index": "index.html",
40+
"main": "main.server.ts",
41+
"polyfills": "polyfills.ts",
42+
"test": "test.ts",
43+
"tsconfig": "tsconfig.server.json",
44+
"testTsconfig": "tsconfig.spec.json",
45+
"prefix": "app",
46+
"styles": [
47+
"styles.css"
48+
],
49+
"scripts": [],
50+
"environmentSource": "environments/environment.ts",
51+
"environments": {
52+
"dev": "environments/environment.ts",
53+
"prod": "environments/environment.prod.ts"
54+
}
3055
}
3156
],
3257
"e2e": {

README.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
1-
# AngularNestjsRender
1+
# Angular NestJS Server Rendering
22

3-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.3.
3+
- /client <-- Angular 5+
4+
- /server <-- NestJS
45

5-
## Development server
6+
### Development
67

7-
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
8+
```bash
9+
npm install
10+
```
811

9-
## Code scaffolding
12+
### Production
1013

11-
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
14+
```bash
15+
npm run build:server
16+
```
1217

13-
## Build
18+
### Test production
1419

15-
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
16-
17-
## Running unit tests
18-
19-
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20-
21-
## Running end-to-end tests
22-
23-
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24-
25-
## Further help
26-
27-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
20+
```bash
21+
npm run serve:server
22+
```

src/app/app.component.html renamed to client/app/app.component.html

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,5 @@ <h1>
55
</h1>
66
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
77
</div>
8-
<h2>Here are some links to help you start: </h2>
9-
<ul>
10-
<li>
11-
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
12-
</li>
13-
<li>
14-
<h2><a target="_blank" rel="noopener" href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></h2>
15-
</li>
16-
<li>
17-
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
18-
</li>
19-
</ul>
8+
<h2>Server Rendering</h2>
209

File renamed without changes.
File renamed without changes.

src/app/app.module.ts renamed to client/app/app.module.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
import { BrowserModule } from '@angular/platform-browser';
22
import { NgModule } from '@angular/core';
33

4-
54
import { AppComponent } from './app.component';
65

7-
86
@NgModule({
97
declarations: [
108
AppComponent
119
],
1210
imports: [
13-
BrowserModule
11+
BrowserModule.withServerTransition({ appId: 'nestJS' })
1412
],
1513
providers: [],
1614
bootstrap: [AppComponent]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)