Last active
June 6, 2021 17:53
-
-
Save yuricamara/dc5186328a42276f5858fe02cdba5b28 to your computer and use it in GitHub Desktop.
Angular Universal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require("firebase-functions"); | |
import * as express from "express"; | |
import {ngExpressEngine} from "@nguniversal/express-engine"; | |
const {AppServerModule} = require("../dist/app/server/main"); | |
const index = "../dist/app/browser/index"; | |
const app = express(); | |
app.engine( | |
"html", | |
ngExpressEngine({ | |
bootstrap: AppServerModule, | |
}), | |
); | |
app.set("view engine", "html"); | |
app.get("/**/*", (req, res) => { | |
res.render(index, { | |
req, | |
res, | |
}); | |
}); | |
exports.ssr = functions.https.onRequest(app); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment