1

I run a node.js server, and use node-static to serve static HTML files.

var nodeStatic = require('node-static');
var file = new nodeStatic.Server('./public');
..
file.serveFile('/file.html', 500, {}, request, response); 

What i would like to do is, serve a static HTML file with a set of variables attached (e.g. over the POST method). I want to include dynamic information in the HTML file, and would like to be able to hand over that dynamic data - ideally in JSON format - from the node server.

Can node-static do that? Or is there another module out there that can?

skaffman
  • 398,947
  • 96
  • 818
  • 769
evsc
  • 260
  • 3
  • 10

1 Answers1

0

What you want is templating. It can be done in both client-side and server-side. (Jade is my favorite) But the client-side performance can be unsatisfying sometimes. Here have a look at these Client-Side Template Engine Benchmarks.

Mustafa
  • 10,013
  • 10
  • 70
  • 116