-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo-config.js
49 lines (46 loc) · 1.11 KB
/
demo-config.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
/**
* demo config
*/
/**
* handle all request
* @param {object} body, request body
* @param {object} req, express request
*/
exports.onRequest = async (body, req) => {
console.log('body:', body)
const { action, params } = body
console.log('param', params)
let result
// check https://github.com/ringcentral/engage-digital-source-sdk/wiki for more info
switch (action) {
case 'implementation.info':
result = {
objects:
{
messages: ['create', 'show', 'list'],
private_messages: ['create', 'show', 'list'],
threads: ['create', 'show', 'list']
},
options: []
}
break
case 'threads.list':
case 'private_messages.list':
case 'messages.list':
result = []
break
case 'threads.show':
case 'private_messages.show':
case 'messages.show':
result = ''
break
default:
result = {}
}
return result
}
// extends or override express app as you need
exports.appExtend = (app) => {
app.get('/ff', (req, res) => res.send('ff'))
// app.get('/some-route', (req, res) => res.end('some'))
}