Last active
July 21, 2017 15:23
-
-
Save jthegedus/774a4985da372b9cc451dc307fda3042 to your computer and use it in GitHub Desktop.
Cloud Functions for Firebase - NextJS example
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
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