Line break Json

Asked

Viewed 1,876 times

1

I’m trying to develop a system with Node.js and I’m trying to list the database data in my table, but the data stay together this way: inserir a descrição da imagem aqui


I still don’t know much about Json, is it because he’s this way?

inserir a descrição da imagem aqui

That’s my job to list:

 Usuario.find(function (err, data) {
                if(err){
                    console.log(err);
                }

                res.render("usuarios/index", {lista: data});
            });

And this is my page:

extends ../layout

block content
        h1 Página de Usuários
        br
        br
        a(href="/" title="Home") Voltar
        br
        br
        table(class="table well")
            thead
            tr
            th ID:
            th Nome:
            th Login:
            th Senha:
            th Data:

        tbody
            each valor, i in lista
                tr
                    td #{valor.id}
                    td #{valor.nome}

CMD: inserir a descrição da imagem aqui

  • you’re using Jade right?

  • 1

    what gives console.log(typeof data, data); within that Usuario.find()?

  • I edited the question and put an image with what appears

  • 1

    Give an insight into the table and show how it is being rendered. Only one addendum, the way the JSON is not interfering with the way the data is displayed on the screen

  • 1

    I really forgot to think about it, I didn’t know I had it in Jade. Problem solved

  • Put an answer so I can tag it as a solution.

Show 1 more comment

1 answer

1


It is necessary to devise the th associated with tr (in your case, of thead), otherwise Jade will interpret as everyone being on the same level as thead.

table(class="table well")
    thead
        tr
            th ID:
            th Nome:
            th Login:
            th Senha:
            th Data:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.