-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (30 loc) · 931 Bytes
/
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
var { APIAI_TOKEN } = process.env
const apiai = require('apiai')(APIAI_TOKEN)
const socketio = require('socket.io')
const express = require('express')
const http = require('http')
const app = express()
const server = http.createServer(app)
const io = socketio(server)
const axios = require('axios')
const cheerio = require('cheerio')
const apiRouter = require('./api')
app.use(express.static(__dirname + '/docs'))
app.use(apiRouter)
app.get('/', (req, res) => {
res.sendFile('index.html')
})
// io.on('connection', function (socket) {
// socket.on('chat message', (text) => {
// axios.post('https://jessie-ai.herokuapp.com/api/req',{
// text
// }).then(({data}) => {
// socket.emit(data.type,data.result)
// }).catch((e) => {
// console.log(e.message)
// })
// })
// })
server.listen(process.env.PORT, () => {
console.log('Server running')
});