-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.js
35 lines (29 loc) · 942 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
35
//=========================================================
// Import NPM modules
//=========================================================
const express = require("express");
const bodyParser = require("body-parser");
const fulfill = require("./lib/fulfilment");
class OnUserSignedInHandlerProvider {
constructor() {
this.handler = (user) => {
return Promise.resolve(user)
}
}
registerHandler(handler) {
this.handler = handler
}
getHandler() {
return this.handler
}
}
module.exports = (directlineSecret, conversationTimeout, shouldGetUsersNameFromGoogle = true) => {
const onUserSignedInHandlerProvider = new OnUserSignedInHandlerProvider();
const router = express.Router();
router.use(bodyParser.json());
router.use(fulfill(directlineSecret, onUserSignedInHandlerProvider, conversationTimeout, shouldGetUsersNameFromGoogle));
return {
onUserSignedInHandlerProvider,
router
};
};