Basic webserver with node.js and express for serving html file and assets

I came across this because I have a similar situation. I don’t need or like templates. Anything you put in the public/ directory under express gets served as static content (Just like Apache). So I placed my index.html there and used sendfile to handle requests with no file (eg: GET http://mysite/):

app.get("https://stackoverflow.com/", function(req,res) {
  res.sendfile('public/index.html');
});

Leave a Comment

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