How to make an Express site without a template engine?

If what you want is directly to serve static html files with the possibility to cache resources, while still being able to hit “https://stackoverflow.com/” and get index.html, then the answer is as easy as this:

var express = require('express');
var http = require('http');
var app = express();

app.use(express.static(__dirname + '/public'));

http.createServer(app).listen(3000);

Gotcha: Html files including index.html must be inside /public folder instead of /views

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)