Import source: backend/src/server
Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { createApp } from './app.js';
|
||||
import { assertProductionEnv, env } from './config/env.js';
|
||||
|
||||
assertProductionEnv();
|
||||
const app = await createApp();
|
||||
|
||||
const server = app.listen(env.port, () => {
|
||||
process.stdout.write(`CShare API listening on http://localhost:${env.port}\n`);
|
||||
});
|
||||
|
||||
server.requestTimeout = 10 * 60 * 1000;
|
||||
server.headersTimeout = 65 * 1000;
|
||||
|
||||
function shutdown(signal: string) {
|
||||
process.stdout.write(`${signal} received; closing HTTP server\n`);
|
||||
server.close((err) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
process.exit(0);
|
||||
});
|
||||
}
|
||||
|
||||
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
||||
process.on('SIGINT', () => shutdown('SIGINT'));
|
||||
Reference in New Issue
Block a user