Boa noite, Estou na aula 2.3 node js e não consigo puxar as informações do banco de dados. Dá o seguinte erro:
Servidor rodando
TypeError: C:/Users/GabrielVellosodeAlbu/WebstormProjects/nodejs_alura_01/casadocodigo/app/views/produtos/lista.ejs:10
8| <td>preco</td>
9| </tr>
>> 10| <% for(var i=0; i<lista.length; i++) {%>
11| <tr>
12| <td><%= lista[i].id %></td>
13| <td><%= lista[i].titulo; %></td>
Cannot read property 'length' of undefined
at eval (eval at <anonymous> (C:\Users\GabrielVellosodeAlbu\WebstormProjects\nodejs_alura_01\casadocodigo\node_modules\ejs\lib\ejs.js:485:12), <anonym
ous>:13:28)
at returnedFn (C:\Users\GabrielVellosodeAlbu\WebstormProjects\nodejs_alura_01\casadocodigo\node_modules\ejs\lib\ejs.js:514:17)
at View.exports.renderFile [as engine] (C:\Users\GabrielVellosodeAlbu\WebstormProjects\nodejs_alura_01\casadocodigo\node_modules\ejs\lib\ejs.js:358:31
)
at View.render (C:\Users\GabrielVellosodeAlbu\WebstormProjects\nodejs_alura_01\casadocodigo\node_modules\express\lib\view.js:126:8)
at tryRender (C:\Users\GabrielVellosodeAlbu\WebstormProjects\nodejs_alura_01\casadocodigo\node_modules\express\lib\application.js:639:10)
at EventEmitter.render (C:\Users\GabrielVellosodeAlbu\WebstormProjects\nodejs_alura_01\casadocodigo\node_modules\express\lib\application.js:591:3)
at ServerResponse.render (C:\Users\GabrielVellosodeAlbu\WebstormProjects\nodejs_alura_01\casadocodigo\node_modules\express\lib\response.js:960:7)
at Query._callback (C:\Users\GabrielVellosodeAlbu\WebstormProjects\nodejs_alura_01\casadocodigo\app\routes\produtos.js:15:20)
at Query.Sequence.end (C:\Users\GabrielVellosodeAlbu\WebstormProjects\nodejs_alura_01\casadocodigo\node_modules\mysql\lib\protocol\sequences\Sequence.
js:85:24)
at C:\Users\GabrielVellosodeAlbu\WebstormProjects\nodejs_alura_01\casadocodigo\node_modules\mysql\lib\protocol\Protocol.js:399:18