-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (22 loc) · 872 Bytes
/
Copy pathapp.js
File metadata and controls
27 lines (22 loc) · 872 Bytes
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
require('dotenv').config();
const bot = require('./bot.js'),
builder = require('botbuilder'),
restify = require('restify');
// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});
// Create chat bot
var connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID ? process.env.MICROSOFT_APP_ID : '',
appPassword: process.env.MICROSOFT_APP_PASSWORD ? process.env.MICROSOFT_APP_PASSWORD : '',
gzipData: true
});
bot.create(connector);
// Listen for messages from users
server.post('/api/messages', connector.listen());
// **Server Stuff** Tell the load balancer that this is healthy
server.get('/', function(req, res, next) {
res.send(200);
});