fix: add koa-route

This commit is contained in:
sean 2017-08-17 12:03:55 +08:00
parent f71b210839
commit c129e68abb
6 changed files with 14 additions and 3 deletions

View File

@ -49,6 +49,8 @@ class InterfaceEdit extends Component{
s.onopen = (e)=>{
console.log('open',e)
s.send('abc')
//s.close()
s.send('aaaaa')
}
s.onclose = (e)=>{

View File

@ -59,6 +59,7 @@
"koa-bodyparser": "^3.2.0",
"koa-logger": "^3.0.0",
"koa-mysql-session": "0.0.2",
"koa-route": "^3.2.0",
"koa-router": "^7.0.1",
"koa-send": "^3.2.0",
"koa-session-minimal": "^3.0.3",

View File

@ -314,6 +314,10 @@ class interfaceController extends baseController {
// do something with the message from client
console.log(message);
});
ctx.websocket.on('close', function(){
console.log('websocket: close')
})
}
}

View File

@ -13,7 +13,7 @@ class interfaceModel extends baseModel {
path: { type: String, required: true },
method: { type: String, required: true },
project_id: { type: Number, required: true },
edit_uid: {type: Number},
edit_uid: {type: Number, default: 0},
status: {type: String, enum: ['undone', 'done'], default: 'undone'},
desc: String,
add_time: Number,

View File

@ -615,7 +615,11 @@ var interfaceController = function (_baseController) {
console.log(message);
});
case 5:
ctx.websocket.on('close', function () {
console.log('websocket: close');
});
case 6:
case 'end':
return _context6.stop();
}

View File

@ -52,7 +52,7 @@ var interfaceModel = function (_baseModel) {
path: { type: String, required: true },
method: { type: String, required: true },
project_id: { type: Number, required: true },
edit_uid: { type: Number },
edit_uid: { type: Number, default: 0 },
status: { type: String, enum: ['undone', 'done'], default: 'undone' },
desc: String,
add_time: Number,