Express JS to Deliver HTML Files (1)

How to load and “display” a basic HTML file : There are many ways to simply send the html file using the node’s core api of using the readfile,but the easy way to do is using the Express Framework on the top of that.Here i am using expressjs serve-static module to deliver the html file.

var express = require('express')
var serveStatic = require('serve-static')

var app = express()

app.use(serveStatic('public/', {'index': ['index.html', 'index.htm']}))


My Name is Dileep Singh, Noder, Javascript Lover & NoSql Developer, Fitness Freak, Love to travel new places, learning photography & Music Manic ♯ ♩ ♬

Posted in Express, Node.Js
One comment on “Express JS to Deliver HTML Files (1)
  1. Azeem says:

    Would you like to send me some best practice express.js e-books…?