I have been diligently working on trying to display an array from my running express app, but despite the lack of errors, nothing is being rendered.
Take a look at my handlebars template:
<h3>Registered Users:</h3>
<h5>{{users}}</h5>
<ul class="list-group">
{{#each users}}
<li class="list-group-item">
{{this.fields.username}}
</li>
{{/each}}
</ul>
This is the express code that retrieves and returns the list of users:
/* GET users listing. */
router.get('/', function(req, res, next) {
api.getUsers(function(response, body){
console.log(body);
res.render('users/list', { 'users': body });
});
});
Initially, I suspected that the users array was not being passed correctly from express. However, when examining the template, the displayed object matched my expectations.
Despite this, the users' list is not appearing on the page, even though there is at least one element in the array. Any suggestions? I am certain it's a minor oversight on my end..