74 lines
1.6 KiB
JavaScript
74 lines
1.6 KiB
JavaScript
/**
|
|
* 应用入口文件
|
|
* 使用 Node Core Framework 启动自动化找工作系统
|
|
*/
|
|
|
|
const frameworkConfig = require('./config/framework.config.js')
|
|
const Framework = require('./framework/node-core-framework.js');
|
|
const schedule = require('./api/middleware/schedule/index.js');
|
|
|
|
// 启动应用
|
|
async function startApp() {
|
|
try {
|
|
console.log('='.repeat(50));
|
|
console.log('🚀 正在启动自动化找工作系统...');
|
|
console.log('='.repeat(50));
|
|
|
|
|
|
|
|
|
|
// 创建框架实例
|
|
const framework = await Framework.init(frameworkConfig);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 启动服务器
|
|
const port = frameworkConfig.port.node;
|
|
|
|
const server = await framework.start(port);
|
|
|
|
|
|
|
|
|
|
console.log('='.repeat(50));
|
|
console.log('🎉 应用启动成功!');
|
|
console.log(`🌐 服务地址: http://localhost:${port}`);
|
|
console.log(`📚 API 文档: http://localhost:${port}/api/docs`);
|
|
console.log(`🔧 管理后台: http://localhost:${port}/admin_api`);
|
|
console.log(`📊 健康检查: http://localhost:${port}/api/health`);
|
|
console.log('='.repeat(50));
|
|
|
|
|
|
// 启动调度系统
|
|
await schedule.init();
|
|
|
|
|
|
// 优雅关闭处理
|
|
process.on('SIGINT', async () => {
|
|
console.log('\n🛑 正在关闭应用...');
|
|
console.log('✅ 应用已安全关闭');
|
|
process.exit(0);
|
|
|
|
});
|
|
|
|
process.on('SIGTERM', async () => {
|
|
console.log('\n🛑 收到终止信号...');
|
|
console.log('✅ 应用已安全关闭');
|
|
process.exit(0);
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
console.warn('❌ 启动失败:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
|
|
// 启动应用
|
|
startApp();
|