-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (40 loc) · 1.06 KB
/
index.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require('dotenv-extended').load()
require('./src/buffer')
const path = require('path')
const express = require('express')
const bodyParser = require('body-parser')
const { connector, bot } = require('./src/bot')
const app = express()
app.use(express.static('public'))
app.use(
bodyParser.json({
limit: '300mb',
extended: true,
parameterLimit: 1000
})
)
app.use(
bodyParser.urlencoded({
limit: '300mb',
extended: true,
parameterLimit: 1000
})
)
app.set('port', process.env.PORT || 5000)
app.use(bodyParser.json())
app.get('/', (req, res) => {
res.sendFile('/public/index.html')
})
app.get('/chat', (req, res) => {
res.sendFile(path.join(__dirname, './public/chat.html'))
})
app.get('/terms-of-use', (req, res) => {
res.sendFile(path.join(__dirname, './public/terms-of-use.html'))
})
app.get('/privacy-rules', (req, res) => {
res.sendFile(path.join(__dirname, './public/privacy-rules.html'))
})
app.post('/api/messages', connector.listen())
app.listen(app.get('port'), () => {
console.log('Node app is running on port', app.get('port'))
})