The best way to handle the html part of a node.js powered site?


I just started learning about node.js and I am currently working through the tutorial available at It's quite good, but I'm confused. In the tutorial all HTML code served by the node server is hard coded into the server, wrapped in response.write() calls. While this does serve the purpose of getting HTML to the client, I don't think many professionals would develop their sites like this. So, what options, if any, are available so that I may separate my server code, and my HTML pages? Thanks for any info on this!

Problem courtesy of: tutiplain


You want to take a look at a web framework to use with node.js.

I recommend Express, but there are many others, depending on your needs. Take a look at this video tutorial on how to get started with Express.

Solution courtesy of: c0deNinja


There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.