Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

259
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda