Quick Node.js-Express Serving HTML Files

Ok. what if you have a Node.js-Express Server, sure you can use Jade or EJS using the template engine but how do you serve the most basic “index.html” files. the following is the code for a bare-bones quick server for “.html” files.

Here is a picture with the file-tree

The HTML file are in the Directory “pages”.

code in “package.json”:

 

For better results on development use: NODEMON



Copyright 2017. All rights reserved.

Posted January 13, 2018 by Edmundo in category "Node