I find a lot of information is not found, I want to use Java as a background service, the use of node+angularjs, but do not know how to use koa to get Java background provides the test images, and displayed in the angularjs side, can you help me, thank you very much.
ctx.body = image) (Koa api: http://127.0.0.1:3000)Need more examples see https://github.com/koajs/examples.
Java background has been written, the front desk has been written, is poor koa this step does not know how to write, I use the koa-router and request module to write, but the picture does not come
.the following is my part of the code
get('/captcha', function *(next){
var $self = this;
yield (loginSer().captcha()
.then(function (response) {
$self.response.length = response.length;
$self.response.type="image/png";
$self.response.body = response;
}));
The result is the following

If I'm not mistaken I believe you should be able to yield the promise directly and rewrite that code like this:
get('/captcha', function *(next){
const image = yield loginSer().captcha()
this.type = 'image/png'
this.body = image
}))
It depends on what response if though, but I'm assuming it's a Buffer of png data.
^ @slaskis's got it
@dounine closing :) please let us know if you have any other questions
Most helpful comment
ctx.body = image) (Koa api: http://127.0.0.1:3000)Need more examples see https://github.com/koajs/examples.