Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions index.js

This file was deleted.

27 changes: 27 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { httpServer } from "./src/http_server/index.js";
import { BattleshipWebSocketServer } from './src/websocket_server/WebsocketServer.js';
import dotenv from 'dotenv';
const HTTP_PORT = 8181;

console.log(`Start static http server on the ${HTTP_PORT} port!`);
httpServer.listen(HTTP_PORT);


dotenv.config();

const PORT = process.env.PORT ? parseInt(process.env.PORT) : 3000;
const server = new BattleshipWebSocketServer(PORT);

console.log(`Server running on ws://localhost:${PORT}`);

process.on('SIGINT', async () => {
console.log('Shutting down server...');
await server.close();
process.exit();
});

process.on('SIGTERM', async () => {
console.log('Shutting down server...');
await server.close();
process.exit();
});
Loading