Spaces:
Running
Running
Download api/server.ts from SESPOIR/realtime-chat-room: direct link, hf CLI and curl.
- Browser
- Download file 687 Bytes
-
https://huggingface.co/spaces/SESPOIR/realtime-chat-room/resolve/main/api/server.ts
- Command line
-
hf download hf://spaces/SESPOIR/realtime-chat-room/api/server.ts
-
curl -L -o server.ts https://huggingface.co/spaces/SESPOIR/realtime-chat-room/resolve/main/api/server.ts
687 Bytes
| /** | |
| * local server entry file, for local development | |
| */ | |
| import app from './app.js'; | |
| import { attachChatHub } from './chatHub.js'; | |
| /** | |
| * start server with port | |
| */ | |
| const PORT = process.env.PORT || 3001; | |
| const server = app.listen(PORT, () => { | |
| console.log(`Server ready on port ${PORT}`); | |
| }); | |
| attachChatHub(server); | |
| /** | |
| * close server | |
| */ | |
| process.on('SIGTERM', () => { | |
| console.log('SIGTERM signal received'); | |
| server.close(() => { | |
| console.log('Server closed'); | |
| process.exit(0); | |
| }); | |
| }); | |
| process.on('SIGINT', () => { | |
| console.log('SIGINT signal received'); | |
| server.close(() => { | |
| console.log('Server closed'); | |
| process.exit(0); | |
| }); | |
| }); | |
| export default app; | |