Spaces:
Sleeping
Sleeping
Download api/server.ts from duqing2026/koa-web-app: direct link, hf CLI and curl.
- Browser
- Download file 616 Bytes
-
https://huggingface.co/spaces/duqing2026/koa-web-app/resolve/main/api/server.ts
- Command line
-
hf download hf://spaces/duqing2026/koa-web-app/api/server.ts
-
curl -L -o server.ts https://huggingface.co/spaces/duqing2026/koa-web-app/resolve/main/api/server.ts
616 Bytes
| /** | |
| * local server entry file, for local development | |
| */ | |
| import app from './app.js'; | |
| /** | |
| * start server with port | |
| */ | |
| const PORT = process.env.PORT || 7860; | |
| const server = app.listen(PORT, () => { | |
| console.log(`Server ready on port ${PORT}`); | |
| }); | |
| /** | |
| * 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; |