mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-30 13:20:24 +08:00
feat: add open controller
This commit is contained in:
parent
57fba7a903
commit
c38fea57c2
21
server/controllers/open.js
Normal file
21
server/controllers/open.js
Normal file
@ -0,0 +1,21 @@
|
||||
const projectModel = require('../models/project.js');
|
||||
const yapi = require('../yapi.js');
|
||||
const baseController = require('./base.js');
|
||||
|
||||
class openController extends baseController{
|
||||
constructor(ctx){
|
||||
super(ctx)
|
||||
this.projectModel = yapi.getInst(projectModel)
|
||||
}
|
||||
|
||||
async projectInterfaceData(ctx){
|
||||
ctx.body = 'projectInterfaceData'
|
||||
}
|
||||
|
||||
async runAutoTest(ctx){
|
||||
ctx.body = 'running...'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = openController;
|
@ -9,7 +9,8 @@ const yapi = require('./yapi.js');
|
||||
const projectController = require('./controllers/project.js');
|
||||
const logController = require('./controllers/log.js');
|
||||
const followController = require('./controllers/follow.js');
|
||||
const { createAction } = require("./utils/commons.js")
|
||||
const openController = require('./controllers/open.js');
|
||||
const { createAction } = require("./utils/commons.js");
|
||||
|
||||
const router = koaRouter();
|
||||
|
||||
@ -45,6 +46,10 @@ let INTERFACE_CONFIG = {
|
||||
test: {
|
||||
prefix: '/test/',
|
||||
controller: testController
|
||||
},
|
||||
open: {
|
||||
prefix: '/open/',
|
||||
controller: openController
|
||||
}
|
||||
};
|
||||
|
||||
@ -435,7 +440,16 @@ let routerConfig = {
|
||||
path: "http/code",
|
||||
method: "post"
|
||||
}
|
||||
]
|
||||
],
|
||||
open: [{
|
||||
action: "projectInterfaceData",
|
||||
path: "project_interface_data",
|
||||
method: "get"
|
||||
},{
|
||||
action: "runAutoTest",
|
||||
path: "run_auto_test",
|
||||
method: "post"
|
||||
}]
|
||||
}
|
||||
|
||||
let pluginsRouterPath = [];
|
||||
|
Loading…
Reference in New Issue
Block a user