2017-12-27 2 views
0

핸드북보기에 전달 된 데이터를 표시하는 방법을 이해할 수 없습니다. 여기에 내 route.js 파일이 있습니다.이 파일은 볼 객체를 전달합니다.명시 적 앱의 핸들 막대보기에 객체를 전달하는 방법

var session = require('express-session'); 
exports.admin = function(req, res){ 
    db.query("SELECT * FROM users", function(err, result, field){ 
     if(err) throw err; 
     console.log(result); 
     console.log(typeof result); 
     res.render('page', {user: result}); 
    }); 
}; 

여기가

<table> 
<thead> 
    <th>First Name</th> 
    <th>Last Name</th> 
    <th>View Details</th> 
</thead> 
<tbody> 
    {{#each user}} 
<td>{{this}}</td> 
{{/each}} 
</tbody> 

답변

0
<tbody> 
    {{#each user}} 
    <tr> 
     <td>{{firstname}}</td> 
     <td>{{lastname}}</td> 
     <td>{{details}}</td> 
    </tr> 
    {{/each}} 
</tbody> 

이름, 성, 자세한 사항은 각 사용자 개체의 속성이 있습니다 (보기) 내 page.hbs 파일입니다