-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
28 lines (20 loc) · 794 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const express = require('express');
const cookieParser = require('cookie-parser');
const cors = require('cors');
require('dotenv').config();
const errorHandler = require('./middlewares/error-handler');
const { botCheckReady, botCollectMessage, botLogin } = require('./discord-bot/discord-bot');
const { getLatestGuildMessages } = require('./controllers/guildNews')
const routes = require('./routes/index');
const { PORT = 3001 } = process.env;
const app = express();
app.use(cookieParser());
app.use(express.json());
app.use(cors({credentials: true, origin: true}));
botCheckReady();
botCollectMessage();
botLogin();
setInterval(() => getLatestGuildMessages(), 1000 * 60 * 15)
app.use(routes);
app.use(errorHandler);
app.listen(PORT, () => console.log('Сервер запущен'));