Created
February 18, 2018 14:48
-
-
Save JulienHe/41eaec589885a36e25cdb2af018de54a to your computer and use it in GitHub Desktop.
app.js - Firebase functions
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
import * as functions from 'firebase-functions'; | |
import next from 'next'; | |
import routes from './routes'; | |
const dev = process.env.NODE_ENV !== 'production'; | |
const app = next({ dev, conf: { distDir: 'next' } }); | |
const handler = routes.getRequestHandler(app); | |
const nextApp = functions.https.onRequest((request, response) => { | |
console.log('File: ' + request.originalUrl); // eslint-disable-line no-console | |
return app.prepare().then(() => handler(request, response)); | |
}); | |
export { nextApp }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment