D
D
Dvorak2016-11-12 21:56:06
Node.js
Dvorak, 2016-11-12 21:56:06

Why call yield like this in koa?

Decided to learn koa. I got acquainted with the documentation, decided to look at the examples. Found this here . I can't figure out why to write:

this.body = yield render('list', { posts: posts });

As I understand it, by calling yield, we simply call the next app.use(). That is, it is middleware. And in theory, nothing should be returned.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2016-11-13
@allishappy

On the question, read https://learn.javascript.ru/generator
Well, in general, this is outdated, use koa 2 , it uses a more understandableasync

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question