Node logo re-styled

Easy Node Live Server

17 January 2021

There are a thousand different ways to get a server up and running in different environments.

For my Laravel programming I was using laragon, which has been working a charm - super easy to set up and configure.

I've created a few create-react-app projects. This is awesome too, however it takes about 10 minutes for me to download all the packages for webpack, the live hot module reloading server, and babel. In the end it's extremely powerful, instantly checking and reloading the code as you type it without changing the client side state.

This weekend I was working on my CV. I built it as a single webpage taken from the front page of my portfolio and converted to a PDF using html-pdf-node.

When I was working on it I really didn't want to have to pull in the entirety of webpack for a dev server. Here's a look at some of the node tools I tried:

HTTP-Server #

First I used HTTP-server. This was really quick to download and provided a very easy server. Really good for if you just want to see what some files look like on a browser without getting errors from trying to pull JavaScript in from a local filesystem.

The problem with this was that I had to continually press Cntrl R all the time to view my changes. I had to do this using laragon too, and a number of times I've been developing. I know there are better ways to do this and I wanted to instantly see my changes with live reload, so I tried:

Nodemon #

Nodemon's a tool that restarts your server whenever files are changed. Unfortunately I couldn't work out how to hook it up with http-server. Maybe it was because I was using it locally instead of globally and the examples were showing how to use the global install. Maybe I was just pointing it at the wrong file or not providing a proper server entry point.

Either way, I ended up giving up. Although I might try this one again some day.

Live-Server #

For me, this was the one. I just installed it globally after what happened with nodemon. I just ran it in the command line, and it just worked. I editted an HTML file and pushed save and watched it reload. I editted a CSS file and watched it reload.


Back to blog