KISS Server for Static HTML File with Express

Server for Static HTML


In one of the posts I have configured Microservice with ASP.NET Core which was called via jQuery from static html file. However there was no server that time and I had to navigate to specific file. So how I can host static html file on Ubuntu? Which server for static HTML file would be simple, stupid?


There is plenty of them. Let me list few that I have considered

  • Appache – old timer, however sounds too heavy
  • nginx – sounds awesome, but still a bit too much
  • kestrel – I’m using it anyway, but I don’t want to have any c# code in this project
  • express – that’s sounds like a good candidate for KISS approach

Installing and Running Express


This is really simple:

  1. npm init => Creates package.json file
  2. Press enter
  3. npm install express –save (only locally and update package.json)


Add index.js

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

//this will set up current folder as the one where index.html exists

app.listen(3000, function () {
  console.log('[Express] Shout.Web started on 3000');


mogluszka@mogluszkaW540:~/Sources/shout/src/web$ node index.js
[Express] Shout.Web started on 3000

Website is available under http://localhost:3000/

Starting ASP.NET Core Service

I need also my backend to run.

mogluszka@mogluszkaW540:~/Sources/shout/src/userService$ dnx kestrel
Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.

Server for Static HTML… done

server for static HTML

One thought on “KISS Server for Static HTML File with Express

Leave a Reply

Your email address will not be published. Required fields are marked *