Skip to content

Instantly share code, notes, and snippets.

@jthegedus
Last active July 21, 2017 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jthegedus/774a4985da372b9cc451dc307fda3042 to your computer and use it in GitHub Desktop.
Save jthegedus/774a4985da372b9cc451dc307fda3042 to your computer and use it in GitHub Desktop.
Cloud Functions for Firebase - NextJS example
const functions = require("firebase-functions")
const next = require("next")
var dev = process.env.NODE_ENV !== "production"
var app = next({ dev, conf: { distDir: "next" } })
var handle = app.getRequestHandler()
exports.next = functions.https.onRequest((req, res) => {
console.log("File: " + req.originalUrl) // log the page.js file that is being requested
return app.prepare().then(() => handle(req, res))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment