forked from cr0111/apiai-skype-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
executable file
·33 lines (24 loc) · 803 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
29
30
31
32
33
'use strict';
const apiai = require('apiai');
const express = require('express');
const bodyParser = require('body-parser');
const morgan = require('morgan-body');
const SkypeBot = require('./skypebot');
const SkypeBotConfig = require('./skypebotconfig');
const REST_PORT = (process.env.PORT || 5000);
const botConfig = new SkypeBotConfig(
process.env.APIAI_ACCESS_TOKEN,
process.env.APIAI_LANG,
process.env.APP_ID,
process.env.APP_SECRET
);
const skypeBot = new SkypeBot(botConfig);
// console timestamps
require('console-stamp')(console, 'yyyy.mm.dd HH:MM:ss.l');
const app = express();
app.use(bodyParser.json());
morgan(app);
app.post('/chat', skypeBot.botService.listen());
app.listen(REST_PORT, function () {
console.log('Rest service ready on port ' + REST_PORT);
});