-
Notifications
You must be signed in to change notification settings - Fork 218
Description
Hi!
I want to use firebase functions to angular universal rendering. I was able to made a deploy at November 19. Today I'm trying to update my app and I realized it's broken.
I didn't change anything in the firebase part.
Here is my stack:
firebase-tools 3.15.0
angular 5.0.0
node 8.8.1
npm 5.4.2
"firebase": "^4.6.2",
"firebase-admin": "^5.5.0",
"firebase-functions": "^0.7.3",
the firebase.json relevant part is:
"hosting": { "public": "dist", "ignore": [ "firebase.json", "**.*", "**/node_modules/**" ], "rewrites": [ { "source": "**", "function": "ssr" } ] }
the function index.js:
const express = require('express'); const path = require('path'); const { enableProdMode } = require('@angular/core'); const { renderModuleFactory } = require('@angular/platform-server'); const { AppServerModuleNgFactory } = require('./dist-ssr/main.bundle'); enableProdMode(); const index = require('fs') .readFileSync(path.resolve(__dirname, './dist/index.html'), 'utf8') .toString(); let app = express(); app.get('**', function(req, res) { renderModuleFactory(AppServerModuleNgFactory, { url: req.path, document: index }).then(html => res.status(200).send(html)); }); exports.ssr = functions.https.onRequest(app);
I made the project towards this post:
https://hackernoon.com/deploy-angular-universal-w-firebase-ad70ea2413a1
This is the result when I deployed the app:

Expected result:
js and css files should be served its real content.