jiekou
This commit is contained in:
parent
5afd0edb0e
commit
344f88b192
@ -42,6 +42,7 @@ let update = async (ctx,nex)=>{
|
||||
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
"GET /":index,
|
||||
"GET /login": login,
|
||||
|
27
controllers/stu.js
Normal file
27
controllers/stu.js
Normal file
@ -0,0 +1,27 @@
|
||||
let addstu = async (ctx,next)=>{
|
||||
const msg = dbs.add("stu",{user: ctx.query.user,pwd: ctx.query.pwd})
|
||||
ctx.body = JSON.stringify(msg)
|
||||
}
|
||||
let getstulist = async (ctx,next)=>{
|
||||
const list = await dbs.find("stu")
|
||||
ctx.body = JSON.stringify(list)
|
||||
}
|
||||
|
||||
let delstu = async (ctx,next)=>{
|
||||
const res = await dbs.remove("stu",{num_key: parseInt(ctx.query.id)})
|
||||
ctx.body = JSON.stringify({...res,id:ctx.query.id})
|
||||
|
||||
}
|
||||
let upstu = async (ctx,nex)=>{
|
||||
console.log(ctx.request.body)
|
||||
const res = await dbs.update("stu",{num_key: ctx.request.body.id},{user: ctx.request.body.user,pwd:ctx.request.body.pwd})
|
||||
ctx.body = JSON.stringify(res)
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
"GET /addstu": addstu,
|
||||
"GET /getstulist": getstulist,
|
||||
"GET /delstu": delstu ,
|
||||
"POST /upstu": upstu
|
||||
}
|
Loading…
Reference in New Issue
Block a user