Agent Host changes for agents/nodejs-express-rest-api-orm-swagger

This commit is contained in:
2026-10-27 19:13:51 +01:00
parent 1456606e39
commit cac3b0c27f
17 changed files with 3548 additions and 626 deletions
+27
View File
@@ -0,0 +1,27 @@
require('dotenv').config();
const app = require('./app');
const { sequelize } = require('./models');
const port = Number(process.env.PORT || 8765);
async function start() {
await sequelize.authenticate();
const server = app.listen(port, () => {
console.log(`REST API listening on http://localhost:${port}`);
});
const shutdown = async () => {
server.close(async () => {
await sequelize.close();
process.exit(0);
});
};
process.on('SIGINT', shutdown);
process.on('SIGTERM', shutdown);
}
start().catch((error) => {
console.error('Unable to connect to the database:', error.message);
process.exitCode = 1;
});