https://github.com/jlmonteagudo/angular-ssr
Sample project of Angular SSR with deployment in Firebase.
https://github.com/jlmonteagudo/angular-ssr
angular angular-ssr angular-universal firebase
Last synced: 9 months ago
JSON representation
Sample project of Angular SSR with deployment in Firebase.
- Host: GitHub
- URL: https://github.com/jlmonteagudo/angular-ssr
- Owner: jlmonteagudo
- Created: 2019-09-06T16:26:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-09T11:54:30.000Z (almost 3 years ago)
- Last Synced: 2025-03-14T01:31:38.733Z (10 months ago)
- Topics: angular, angular-ssr, angular-universal, firebase
- Language: TypeScript
- Size: 1.98 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 37
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ssr
Sample project of Angular SSR with deployment in Firebase.
## Steps to run
- clone this repo
- npm install
- npm run build:ssr
- cd functions
- npm install
- npm run build
- firebase deploy
## Steps to prepare an Angular project manually for SSR and deploy in Firebase
- ng add @nguniversal/express-engine --clientProject YOUR-PROJECT-NAME
- npm install -g firebase-tools
- firebase login
- firebase init
- Which firebase CLI features do you want to setup? Functions and Hosting
- What language would you like to use to write Cloud Functions? TypeScript
- What do you want to use as your public directory? dist/browser
- Configure as a single page app? Y
- File index.html already exists. Overwrite? N
- Update firebase.json: replace "destination": "/index.html" by "function": "ssr"
- Update server.ts: add export to the app initialization: export const app = express(); comment out the last three lines
- Update webpack.server.config.js: add this to output: library: 'app', libraryTarget: 'umd'
- Update webpack.server.config.js: update this property: externals: [/node_modules/]
- npm run build:ssr
- cd functions
- npm i fs-extra
- create the file copy-angular-app.js in the folder functions
- Update functions/package.json: "build": "node copy-angular-app && tsc",
- Update functions/src/index.ts
- npm run build
- firebase deploy