Static HTTP server built on node.js
Latest commit b29c848 Oct 16, 2010 @mhansen Allow requests to files with non-ascii characters
(with URL encoded requests)
Failed to load latest commit information.
tests Allow requests to files with non-ascii characters Oct 17, 2010
.gitignore ignore vims .swp files May 14, 2010
LICENSE licensed all code under MIT Feb 9, 2010
README.markdown older node.js versions dont have sys.pump Aug 11, 2010
TODO Last-Modified header Feb 14, 2010
autotest.watchr simplify watch script by removing interrupt catcher May 26, 2010
runtests.js Shiny new test suite! (ported tests to nodeunit) May 21, 2010
server.js show detailed error when you cant find settings.json Jul 28, 2010


Antinode is a simple static file webserver built on node.js.


Run it from the command line.

$ node server.js [settings.json]

Requires Node.JS v0.1.100 or greater. If you want to bind to a port under 1024, you'll need to run node with special privileges.


Configuration is through a JSON text file, by default the settings.json in the same folder as server.js.

Example settings file:

    "port" : 8080,
    "hosts" : {
        "" : { 
            "root" : "/www/subdomain1/"
        "" : {
            "root" : "/www/subdomain2/"
    "default_host" : {
        "root" : "/www/default/"

This server listens on port 8080 for HTTP requests. If it gets a request for Host: the site will serve /www/subdomain1/, and similarly requests for Host: will respond with the files from /www/subdomain2. If the Host header does not match either, or is not given, antinode will serve files from /www/default.

Explanation of properties:

  • port - the port to listen for HTTP connections on. default: 8080
  • hosts - an object with one property name per virtual host address, with the value of a 'virtual host' object to
  • default_host - the 'virtual host' object to default to if no other virtual hosts match, or the HTTP Host header is not given

'virtual host object' - has a property root giving the directory to serve web requests from

This serves up all the files in /var/www listening to HTTP requests on port 8080. E.g. an HTTP request for /styles/site.css will will look for the file /var/www/styles/site.css


  • HTTP Content-Type header detection from file extension
  • HTTP Content-Length header support
  • HTTP Date header
  • HTTP Last-Modified header
  • Reads files in binary mode - so can serve images and other binary files (not just text)
  • Requests to any directory try to return directory/index.html
  • Virtual Hosts

Test Suite

To run the tests:

$ node runtests.js


Original code forked from Noah Sloan's simple logging webserver.