Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

小白求问要怎么访问后台接口api,想通过koa发请求 #7

Closed
greyj2009 opened this issue Mar 8, 2017 · 1 comment
Closed

Comments

@greyj2009
Copy link

greyj2009 commented Mar 8, 2017

async function getMessageList(ctx) {
ctx.url=HOST+'/message/query';
ctx.method='POST';
ctx.query= {


userId:'13145674567',
entId:'2',
startDate:'2016-10-10',
endDate:''
};
let messages =ctx.request.body || 0;
ctx.body = "you post data:"+JSON.stringify({messages:messages});
}

比如这个,配置了server端的routes,不知道controllers该怎么写

@chikara-chan
Copy link
Owner

建议你走一遍nodejs koa的教程

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants