H is for Harre.

harre.dev

Express

Express route management

Setting up a webserver with Node and Express is easy very easy.

Here is a small example:

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

app.get("/", function (request, response) {
	response.send("Hello world!");
});

app.listen(3000);

Running this and navigating to http://localhost:3000 will give you the following result:

Hello world

If you only have a few of those endpoints (app.get etc.) things will be fine living in the same index.js file. But what if this starts growing? You add more and more endpoints to your index.js and before you know it you have a 1500 line Javascript mess. Here is a good way of tackling that problem before it rears its head.