Spaces:
Running
Running
Download index.js from 4send/messenger: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/4send/messenger/resolve/main/index.js
- Command line
-
hf download hf://spaces/4send/messenger/index.js
-
curl -L -o index.js https://huggingface.co/spaces/4send/messenger/resolve/main/index.js
1.22 kB
| const http = require('http'); | |
| const mongoose = require('mongoose'); | |
| const app = require('./app'); | |
| const { initSocket } = require('./socket/index'); | |
| const { PORT, MONGO_URI } = require('./constants/allowed'); | |
| const { runMigration, loadPrivacyMap, dedupPins } = require('./services/migration'); | |
| const { startAutoDeleteJob } = require('./jobs/autoDeleteUsers'); | |
| const { startNotificationRepeatJob } = require('./jobs/notificationRepeat'); | |
| const { startSessionCleanupJob } = require('./jobs/sessionCleanup'); | |
| const { startMessageExpiryJob } = require('./jobs/messageExpiry'); | |
| if (!MONGO_URI) { | |
| process.stderr.write('MONGO_URI is not set\n'); | |
| process.exit(1); | |
| } | |
| const server = http.createServer(app); | |
| initSocket(server); | |
| mongoose.connect(MONGO_URI, { serverSelectionTimeoutMS: 5000 }) | |
| .then(async () => { | |
| await runMigration(); | |
| await loadPrivacyMap(); | |
| await dedupPins(); | |
| startAutoDeleteJob(); | |
| startNotificationRepeatJob(); | |
| startSessionCleanupJob(); | |
| startMessageExpiryJob(); | |
| server.listen(PORT, '0.0.0.0'); | |
| }) | |
| .catch((err) => { | |
| process.stderr.write(`[MONGO] ${err.message}\n`); | |
| process.exit(1); | |
| }); | |
| module.exports = app; |