Files
nixpanel-server/server/src/index.ts
T
NixReaper 92d08d7b79 feat: rename WHM→NixServer, cPanel→NixClient, bump v0.2.0
- Rename frontend workspaces: whm/ → nixserver/, cpanel/ → nixclient/
- Rename server route dirs: routes/whm/ → routes/nixserver/, routes/cpanel/ → routes/nixclient/
- Update all API prefixes: /api/whm → /api/nixserver, /api/cpanel → /api/nixclient
- Rename env vars: WHM_PORT → NIXSERVER_PORT, CPANEL_PORT → NIXCLIENT_PORT
- Update config properties: whmPort → nixserverPort, cpanelPort → nixclientPort
- Update all UI labels, login pages, sidebar branding, and error messages
- Update installer and update scripts to match new names
- Add cpanel email route (missing from initial scaffold)
- Add .gitattributes to enforce LF line endings
- Bump version to 0.2.0 across all package.json files
2026-04-05 10:54:15 -05:00

40 lines
1.0 KiB
TypeScript

import 'dotenv/config'
import { buildApp } from './app.js'
import { config } from './config.js'
import prisma from './db/client.js'
async function start() {
let app
try {
// Verify DB connection
await prisma.$connect()
console.log('Database connected')
app = await buildApp()
// NixServer on port 2087
await app.listen({ port: config.server.nixserverPort, host: config.server.host })
console.log(`NixServer running on port ${config.server.nixserverPort}`)
console.log(`NixClient API running on port ${config.server.nixserverPort} (/api/cpanel)`)
} catch (err) {
console.error('Failed to start server:', err)
await prisma.$disconnect()
process.exit(1)
}
// Graceful shutdown
const shutdown = async (signal: string) => {
console.log(`${signal} received, shutting down...`)
await app?.close()
await prisma.$disconnect()
process.exit(0)
}
process.on('SIGTERM', () => shutdown('SIGTERM'))
process.on('SIGINT', () => shutdown('SIGINT'))
}
start()