feat: add open controller

This commit is contained in:
suxiaoxin 2018-02-08 10:52:01 +08:00
parent 57fba7a903
commit c38fea57c2
2 changed files with 37 additions and 2 deletions

View 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;

View File

@ -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 = [];