Created
February 24, 2020 05:38
-
-
Save InputNeuron/7179ed533f4ed3ae303d4f5862d124ce to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import {createWebapp} from "../../webapp/Webapp"; | |
| import * as functions from "firebase-functions"; | |
| import express from 'express'; | |
| const app = createWebapp(); | |
| app.use(require('prerender-node').set('prerenderToken', 'xxxxxxxxx')); | |
| // https://expressjs.com/en/guide/error-handling.html | |
| // add a better error handler | |
| app.use(function(err: Error, req: express.Request, res: express.Response, next: express.NextFunction) { | |
| console.error("Could not handle SSR: \n" + err.stack); | |
| if (res.headersSent) { | |
| return next(err); | |
| } | |
| res.status(500).send('Internal Server Error'); | |
| }); | |
| export const SSRFunction = functions.https.onRequest(app); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment