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

248
Visualizações
The simplest way to serve webpages with dynamic content with nodejs + express

I'm building a web application with nodejs and express which has two views, one for writing and submitting the written data to a database, and another one for viewing the data from the database.

What would be the simplest way to serve the html file with the content loaded from the database? Would I need to use a templating engine or is there a simpler way of adding the loaded content to a html file? I'm trying to avoid bloating the app with unnecessary overhead and keeping it as simple as possible.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You can have a simple express app, with a "pubic" directory for serving your static html. Then you can implement API endpoints with express.js for saving data and retrieving data.

The express "generator" can generate a simple skeleton of what you're looking for: https://expressjs.com/en/starter/generator.html

You can use an ORM like Bookshelf.js to handle database operations from within your API endpoints

over 4 years ago · Santiago Trujillo Relatório

0

Considering you are using DB for the data, I assume the content is not static. It is changing from time to time or from user to user. So if you want to display different data in different situations you have two options.

You should you a template engine, insert your data, and return to enduser or you should send the static html content to the request, and then ask for the dinamic data with ajax from the client-side.

over 4 years ago · Santiago Trujillo 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