Skip to content

Instantly share code, notes, and snippets.

@JulienHe
Created February 18, 2018 14:48
Show Gist options
  • Save JulienHe/41eaec589885a36e25cdb2af018de54a to your computer and use it in GitHub Desktop.
Save JulienHe/41eaec589885a36e25cdb2af018de54a to your computer and use it in GitHub Desktop.
app.js - Firebase functions
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