Skip to content

Instantly share code, notes, and snippets.

@yuricamara
Last active June 6, 2021 17:53
Show Gist options
  • Save yuricamara/dc5186328a42276f5858fe02cdba5b28 to your computer and use it in GitHub Desktop.
Save yuricamara/dc5186328a42276f5858fe02cdba5b28 to your computer and use it in GitHub Desktop.
Angular Universal
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