Created
July 7, 2019 03:52
-
-
Save evdama/711126c9a87252b2d998b395df22b0c5 to your computer and use it in GitHub Desktop.
firebase cloud function for sapper doing SSR with cache control
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
// @ts-nocheck TODO: remove once there are typings in place | |
// Start writing Firebase Functions | |
// https://firebase.google.com/docs/functions/typescript | |
const functions = require('firebase-functions'); | |
// We have to import the built version of the server middleware. | |
const { app } = require('../__sapper__/build/server/server'); | |
app.get('/', (request, response) => { | |
response.set( | |
'Cache-Control', | |
'public, max-age=300, s-maxage=1200, proxy-revalidate' | |
); | |
response.send(app); | |
}) | |
exports.ssr = functions | |
.region('us-central1') | |
.https.onRequest(app); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment