Files
order-notification-automation/src/server.cjs
T

12 lines
753 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const {createServer,startService}=require('./app/bridge.cjs');
const {main}=require('./app/application.cjs');
const {safeDiagnostic}=require('./shared/diagnostics.cjs');
const startupAt=performance.now();
if (require.main === module) main().then(app=>{
const stop=()=>app.stop().then(()=>process.exit(0),()=>process.exit(1));
process.once('SIGINT',stop);process.once('SIGTERM',stop);
process.on('message',message=>{if(message==='order:shutdown')stop();});
console.info('启动耗时(ms):'+Math.round(performance.now()-startupAt));
}).catch(error => { console.error('启动失败:'+JSON.stringify(safeDiagnostic(error,{durationMs:performance.now()-startupAt}))); process.exitCode=1; });
module.exports = { createServer, startService, main };