Skip to content

(Universal) Update getting-started.md #2372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions docs/universal/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,66 @@

Server-side rendering (SSR) is the process of converting a JavaScript app to plain HTML at request-time, allowing search engine crawlers and linkbots to understand page content reliably.

# Angular 9.0 and above instruction:

## 0. Prerequisites

- @angular/cli >= v9.0
- @angular/fire >= v6.0.0-rc.2

## 1. Generate the Application and add necessary library
Base on this https://angular.io/guide/universal
```
ng new workspace --createApplication="false"
cd workspace
ng generate application web
```
for the simple angular project, you can skip `--clientProject`
```
ng add @nguniversal/express-engine --clientProject=web
ng add @angular/fire --clientProject=web
npm i @angular/fire@6.0.0-rc.2 --save
```
## 1. Edit file
Insert polyfills at the top of file
```
// server.ts
...
// Polyfills required for Firebase
(global as any).WebSocket = require('ws');
(global as any).XMLHttpRequest = require('xhr2');
...

```


```
// angular.json
// projects.web.architect
...
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
...
"externalDependencies": [
"@firebase/firestore"
]
...
}


...

```

## 2. Setup Firebase detail
- follow this guilde https://github.com/angular/angularfire/blob/master/docs/install-and-setup.md

## 3. Running
`npm run dev:ssr`

# Angular version 5.0 to 9.0 instruction:

## 0. Prerequisites

- @angular/cli >= v6.0
Expand Down