test: add jest/supertest infrastructure and make server.js testable
Made-with: Cursor
This commit is contained in:
@@ -12,9 +12,6 @@ const PORT = process.env.PORT || 5000;
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
// Bootstrap database with games
|
||||
bootstrapGames();
|
||||
|
||||
// Health check
|
||||
app.get('/health', (req, res) => {
|
||||
res.json({ status: 'ok', message: 'Jackbox Game Picker API is running' });
|
||||
@@ -50,8 +47,12 @@ const server = http.createServer(app);
|
||||
const wsManager = new WebSocketManager(server);
|
||||
setWebSocketManager(wsManager);
|
||||
|
||||
server.listen(PORT, '0.0.0.0', () => {
|
||||
console.log(`Server is running on port ${PORT}`);
|
||||
console.log(`WebSocket server available at ws://localhost:${PORT}/api/sessions/live`);
|
||||
});
|
||||
if (require.main === module) {
|
||||
bootstrapGames();
|
||||
server.listen(PORT, '0.0.0.0', () => {
|
||||
console.log(`Server is running on port ${PORT}`);
|
||||
console.log(`WebSocket server available at ws://localhost:${PORT}/api/sessions/live`);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = { app, server };
|
||||
|
||||
Reference in New Issue
Block a user