Add membership backend and signer login
This commit is contained in:
32
server/dev.js
Normal file
32
server/dev.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { spawn } from 'node:child_process'
|
||||
|
||||
const processes = [
|
||||
spawn(process.execPath, ['server/server.js'], {
|
||||
stdio: 'inherit',
|
||||
env: { ...process.env, PORT: process.env.PORT || '3001' },
|
||||
}),
|
||||
spawn(process.execPath, ['node_modules/vite/bin/vite.js', '--host'], {
|
||||
stdio: 'inherit',
|
||||
env: process.env,
|
||||
}),
|
||||
]
|
||||
|
||||
let isShuttingDown = false
|
||||
|
||||
const shutdown = (code = 0) => {
|
||||
if (isShuttingDown) return
|
||||
isShuttingDown = true
|
||||
for (const child of processes) {
|
||||
if (!child.killed) child.kill('SIGTERM')
|
||||
}
|
||||
process.exit(code)
|
||||
}
|
||||
|
||||
for (const child of processes) {
|
||||
child.on('exit', (code) => {
|
||||
if (!isShuttingDown && code !== 0) shutdown(code || 1)
|
||||
})
|
||||
}
|
||||
|
||||
process.on('SIGINT', () => shutdown(0))
|
||||
process.on('SIGTERM', () => shutdown(0))
|
||||
Reference in New Issue
Block a user