-
Notifications
You must be signed in to change notification settings - Fork 22
/
server.js
executable file
·42 lines (36 loc) · 1 KB
/
server.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
const yapi = require('yapi.js');
const controller = require('./controller/controller.js');
const syncTokenUtils = require('./utils/syncTokenUtil.js');
module.exports = function () {
yapi.getInst(syncTokenUtils);
//保存获取token的任务
this.bindHook('add_router', function (addRouter) {
addRouter({
controller: controller,
method: 'post',
path: 'oauthInterface/save',
action: 'saveOauthInfo'
});
//根绝projectId和envId查询获取token的任务
addRouter({
controller: controller,
method: 'get',
path: 'oauthInterface/get',
action: 'getOauthInfo'
});
//根据projectId查询所有的token任务
addRouter({
controller: controller,
method: 'get',
path: 'oauthInterface/project/all',
action: 'getAllOauthByProjectId'
});
//校验get_token_url
addRouter({
controller: controller,
method: 'post',
path: 'oauthInterface/url/valid',
action: 'validateTokenUrl'
});
});
};