DEV Community

Cory Allen
Cory Allen

Posted on

1 1

Sequelize, Express.js, & Handlebars.js being turds?

My brain is sizzling, either I am overlooking a tiny detail or this is supposed to work and doesn't for whatever reason. Just trying to render by findAll() query to the page using handlebars. Here's what I have.

Controller:

const library = require('../models/Library');
exports.manage_library = (req, res) => {
    Library.findAll()
        .then(function(data) {
            res.render('manage-library', {
                title: "Manage Website",
                user: req.user,
                data: data
            })
        });
}
Enter fullscreen mode Exit fullscreen mode

View:

                    {{#each data}}
                        <div class="list-group-item d-flex justify-content-between">
                        <div><strong>{{this.name}}</strong></div>
                        <div>
                            <a href="/edit-category/{{this.id}}" class="btn btn-sm btn-warning"><i class="bi bi-pencil"></i></a>
                            <a href="/delete-category/{{this.id}}" class="btn btn-sm btn-danger"><i class="bi bi-trash3"></i></a>
                        </div>
                    </div>
                    {{/each}}
Enter fullscreen mode Exit fullscreen mode

I am new to Node & Express, this is my first serious project so forgive me if I am overlooking something minor. Basically, the above code renders the appripriate amount of list-group-item but I cannot display actual data within the list-group-item.

What the glorp am I doing wrong?! πŸ‘½

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (1)

Collapse
 
constmedic profile image
Cory Allen β€’

SOLVED:

Adding raw: true; to the query fixed the issue.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

AWS Security LIVE!

Hosted by security experts, AWS Security LIVE! showcases AWS Partners tackling real-world security challenges. Join live and get your security questions answered.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❀️