Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!