SPB Git

Repository Public

start.mjs 927 B 18 lines javascript

1#!/usr/bin/env node2// Starts the standalone server. Production: 127.0.0.1:8733, reached only through the Go control-api.3import { spawn } from "node:child_process";4import { existsSync } from "node:fs";5import { dirname, join, resolve } from "node:path";6import { fileURLToPath } from "node:url";78const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");9const server = join(root, ".next/standalone/apps/web/server.js");10if (!existsSync(server)) {11  console.error("Build first: pnpm build");12  process.exit(1);13}14const env = { ...process.env, NODE_ENV: "production", HOSTNAME: process.env.MCC_WEB_HOST ?? "127.0.0.1", PORT: process.env.MCC_WEB_PORT ?? process.env.PORT ?? "8733" };15const child = spawn(process.execPath, [server], { stdio: "inherit", env, cwd: dirname(server) });16for (const sig of ["SIGINT", "SIGTERM"]) process.on(sig, () => child.kill(sig));17child.on("exit", (code) => process.exit(code ?? 0));18
Files main
Menu

Theme