Merge pull request #3 from kjannette/buildout-server-module

Buildout server module
This commit is contained in:
S Jannette
2026-05-18 17:55:43 -04:00
committed by GitHub
2 changed files with 11 additions and 1 deletions

View File

@@ -6,3 +6,13 @@ const app = createApp();
const server = app.listen(PORT, () => {
console.log(`Server running on http://localhost:${PORT}`);
});
function shutdown(signal: string) {
console.log(`${signal} received — shutting down...`);
server.close(() => {
console.log('All connections closed. Exiting.');
process.exit(0);
});
}
process.on('SIGTERM', () => shutdown('SIGTERM'));
process.on('SIGINT', () => shutdown('SIGINT'));

View File

@@ -1,5 +1,5 @@
import { User, CreateUserDto, UpdateUserDto } from '../models/User';
// In-memory store — replace with DB client in a real app
const store: User[] = [];
let nextId = 1;
export const userRepository = {