

If you want it to automatically watch for changes in your files and reload the page any time a file changes, just use the files option specifying the files you want to watch. Īnd the browser should automatically open the Local URL shown above. You’ll see an output like this: Access URLs: - Local: External: - UI: UI External: - Serving files from.

You can of course use it just to serve your static files by using this command: npx browser-sync start -server Browsersyncīrowsersync has been around for quite some time and it’s very popular while doing development. However, you don’t need to know the details in order to run your any of te options below. If you’re not familiar with NPX, here’s an article I wrote about it explaining it in detail. When you install Node, you get NPM and NPX installed as well. If you have NodeJS installed in your machine, there are several packages available through NPM/NPX that you can use. You should first enter to your “project” folder in the command line doing something like this: cd /project Node Based Servers For example, if your code is in the folder “project” / |- project |- index.html |- js |- main.js

Nowadays, there are several simple options to get a static server running quickly, and that’s what I’m covering in this article.įor all of the options below that use the command line, I’m assuming that you already entered the folder where your files are located. While developing applications, learning to use a library or just testing out something quick, you might encounter the need to host your files in a “static” server - meaning that you just need an HTTP server to serve files as-is from a directory.
