Skip to content

Instantly share code, notes, and snippets.

@evdama
Created July 7, 2019 03:52
Show Gist options
  • Save evdama/711126c9a87252b2d998b395df22b0c5 to your computer and use it in GitHub Desktop.
Save evdama/711126c9a87252b2d998b395df22b0c5 to your computer and use it in GitHub Desktop.
firebase cloud function for sapper doing SSR with cache control
// @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