19 lines
652 B
TypeScript
19 lines
652 B
TypeScript
|
|
/**
|
|||
|
|
* 本地启动平台服务:node server/dist/bin/serve.js(或 pnpm dev:server)。
|
|||
|
|
* A1.5 会把这条命令与界面、数据库串成一条一键启动。
|
|||
|
|
*/
|
|||
|
|
import { startServer } from '../index.js';
|
|||
|
|
|
|||
|
|
const port = Number.parseInt(process.env.APS_PORT ?? '5199', 10);
|
|||
|
|
const host = process.env.APS_HOST ?? '127.0.0.1';
|
|||
|
|
|
|||
|
|
const server = await startServer({ host, port });
|
|||
|
|
|
|||
|
|
console.log(`平台服务已启动:${server.url}(协议 v1)`);
|
|||
|
|
console.log(`健康检查:${server.url}/v1/health`);
|
|||
|
|
|
|||
|
|
for (const signal of ['SIGINT', 'SIGTERM'] as const) {
|
|||
|
|
process.on(signal, () => {
|
|||
|
|
void server.close().then(() => process.exit(0));
|
|||
|
|
});
|
|||
|
|
}
|