// Startup file for cPanel "Setup Node.js App" (Passenger).
// Serves the pre-built Next.js production app. Passenger provides the port via
// the PORT env var; locally it falls back to 3000.
const { createServer } = require("http");
const next = require("next");

const port = process.env.PORT || 3000;
const app = next({ dev: false, dir: __dirname });
const handle = app.getRequestHandler();

app.prepare().then(() => {
  createServer((req, res) => handle(req, res)).listen(port, () => {
    console.log(`> Marketing KPI ready on port ${port}`);
  });
});
