Skip to content

Instantly share code, notes, and snippets.

@evdama
Created July 14, 2019 03:00
Show Gist options
  • Select an option

  • Save evdama/2a5c529cca296c1bc7b52154c7b1e7cc to your computer and use it in GitHub Desktop.

Select an option

Save evdama/2a5c529cca296c1bc7b52154c7b1e7cc to your computer and use it in GitHub Desktop.
usage of underscore prepend for unused paramter and compiler option "noUnusedParameters": true
// TODO: replace type any for request and response
// Start writing Firebase Functions
// https://firebase.google.com/docs/functions/typescript
// https://github.com/firebase/functions-samples/tree/master/typescript-getting-started
// https://stackoverflow.com/questions/41685054/clarification-on-typescripts-nounusedparameters-compiler-option
import * as functions from 'firebase-functions';
// We have to import the built version of the server middleware.
const { app } = require('../__sapper__/build/server/server');
const oneHour = 60 * 60
const oneDay = oneHour * 24
const oneWeek = oneDay * 7
const oneMonth = oneWeek * 4
app.get('/', (_request: any, response: any) => {
response.set(
'Cache-Control',
`public, max-age=${oneWeek}, must-revalidate, s-maxage=${oneMonth}, proxy-revalidate, stale-while-revalidate=${oneDay}, stale-if-error=${oneWeek}`
);
response.send(app);
})
export const 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