-
-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathserver.js
More file actions
23 lines (19 loc) 路 727 Bytes
/
Copy pathserver.js
File metadata and controls
23 lines (19 loc) 路 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const admin = require("firebase-admin");
const functions = require("firebase-functions");
const next = require("next");
const config = require("./next.config");
admin.initializeApp();
const dev = process.env.NODE_ENV !== "production";
const app = next({
dev,
// the absolute directory from the package.json file that initialises this module
// IE: the absolute path from the root of the Cloud Function
conf: config,
});
const handle = app.getRequestHandler();
const server = functions.https.onRequest((request, response) => {
// log the page.js file or resource being requested
console.log("File: " + request.originalUrl);
return app.prepare().then(() => handle(request, response));
});
exports.nextjs = { server };