(res: ServerResponse, message: string, status = 500)
| 47 | } |
| 48 | |
| 49 | function sendError(res: ServerResponse, message: string, status = 500): void { |
| 50 | res.writeHead(status, { 'Content-Type': 'application/json' }) |
| 51 | res.end(JSON.stringify({ error: message })) |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Creates an HTTP request handler for the socket server |