After a few hours of hacking spread out during these last couple of days I’m releasing yet another Node.js thing called Servera1. It’s a small app for managing and serving all your local static sites by configuring all your projects in a single json file. The idea is to map them by using this convention:

  "myproject": {
    "dir": "/home/USERNAME/Dev/myproject",
    "port": 3000
  "anotherproject": {
    "dir": "C:/Users/USERNAME/Dev/anotherproject",
    "port": 6000

The only thing you need to do to launch the server is to run servera myproject and then go to localhost:3000 (or whatever port you’ve specified) in your browser. You can also serve the current working directory by running servera . and you can list all your projects with servera list.

It’s heavily inspired by distra, although it’s a dumbed down version without the whole /etc/hosts configuration part2. I’ve tested it on both Windows and Linux, and it should hopefully work on OS X too.

It’s a pretty simple thing, but I feel that it could actually be useful.

Under the hood

Servera uses four additional modules: fs-extra, connect, colors and commander. fs-extra is used for copying the sample configuration file to your home directory while connect is the main server. colors is used to colorize the output in the terminal and commander handles the argument parsing.

It’s all pretty basic stuff, but together they work really well.

  1. Which is the swedish word for “serve”. I’m original like that. 

  2. I’m pretty sure that there’s no easy way of doing that on Windows without using brute force or some other vodoo. 

comments powered by Disqus