Created
February 24, 2020 14:53
-
-
Save InputNeuron/7cf56ea9a93c1442d17b5e5cf7321a91 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', 'xxxx')); | |
| // 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