Download src/app.js from pnacorp/xsender: direct link, hf CLI and curl.
- Browser
- Download file 719 Bytes
-
https://huggingface.co/pnacorp/xsender/resolve/main/src/app.js
- Command line
-
hf download hf://pnacorp/xsender/src/app.js
-
curl -L -o app.js https://huggingface.co/pnacorp/xsender/resolve/main/src/app.js
719 Bytes
| import 'dotenv/config' | |
| import express from 'express' | |
| import nodeCleanup from 'node-cleanup' | |
| import routes from './routes.js' | |
| import { init, cleanup } from './whatsapp.js' | |
| import cors from 'cors' | |
| const app = express() | |
| const host = process.env.NODE_SERVER_HOST || undefined | |
| const port = parseInt(process.env.NODE_SERVER_PORT ?? 3001) | |
| app.use(cors()) | |
| app.use(express.urlencoded({ extended: true })) | |
| app.use(express.json()) | |
| app.use('/', routes) | |
| const listenerCallback = () => { | |
| init() | |
| console.log(`Server is listening on http://${host ? host : 'localhost'}:${port}`) | |
| } | |
| if (host) { | |
| app.listen(port, host, listenerCallback) | |
| } else { | |
| app.listen(port, listenerCallback) | |
| } | |
| nodeCleanup(cleanup) | |
| export default app |