Table of Contents

About

This is a minimal template consisting in an asynchronous HTTP(s) server built with node.js with support for various features such as URL/path re-writing, authentication or HTTPs support for serving "static" websites.

Checkout

The server can be found in the Wizardry and Steamworks Subversion repository at the following link:

Please see the install instructions on how to install the server.

Features

Design

The main incentive behind the Wizardry and Steamworks node.js HTTP server is to cut down on the complexity of other popular HTTP servers by implementing some of the most popular basic features and to use intelligent design patterns to provide an accessible way to websites to interact with the backend.

For instance, the template will return JSON-based directory indexes that are easily processed using client-side Javascript. Similarly, for secure browsing, the template automatically generates self-signed certificates, thereby alleviating the burdensome task of managing certificates manually.

The code is written entirely asynchronous with no synchronous code-blocks by making use of events and cascading lambda function calls thereby avoiding any sort of blocking.

One of the goals of the template is to provide a HTTP server that can serve a website built using state-of-the-art tools such as bootstrap, sass and using solely Javascript in both the frontend and backend.

Installing

To install this template, check out the source by issuing:

svn co http://svn.grimore.org/node-http-server

and then change directory to the server directory:

cd node-http-server

and issue:

npm install

in order to automatically install the required modules.

Configuring

To configure the server, create a copy of config.js.dist as config.js and edit config.js.

Running

The template will server web-pages by taking the path to a directory to server over HTTP as a command-line parameter:

./server.js -d /var/www

where:

Note that, just like other popular HTTP servers, the Wizardry and Steamworks node.js HTTP server will attempt to first serve the default document index (the default document can be configured in config.js under site). By default the document index is index.html.