Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
How to render mongoDB data without using any template engine

How to render data from mongoDB without the usage of any template engine(ejs, handlebars)??? Is it possible to render data strait to html? How? I've never done this before and have no idea how to do that. Please, help me!!! I'll be glad to any information or link where to read about it.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can do one thing make a fetch() request from html and open an endpoint in your backend.

example:-

in backend

app.get("/products", async (req, res) => {
  const products = await getProductsFromMongodb();

  res.status(200).json(products);
});

in html

<body>
  <ul>
    <li>products lists here...</li>
  </ul>
  <script>
    async function fetchProducts() {
      try {
        const response = await fetch("/products");

        if (response.ok) {
          const products = await response.json();
          // show products name,tags ,description,etc...  in  lists of card by looping products
        } else {
          // show user friendly error inside to screen
        }
      } catch (error) {
        console.log(error);
        // show user friendly error inside to screen
      }
    }

    window.onload = () => {
      fetchProducts();
    };
  </script>
</body>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda