Woses

Woses is a Node-based webserver with support for PHP templating.

Additionally it includes a mechanism for server-side JavaScript RPC.

The home page for Woses is http://grumdrig.com/woses/. The code lives at http://github.com/grumdrig/woses.

Usage

$ node woses.js DOCUMENT_ROOT
will run the HTTP server against the content in DOCUMENT_ROOT. For example,
$ node woses.js doc

will serve this documentation on port 8080.

Included also is the script serverloop.py which runs the server in a loop, polling for changes to the configuration file, woses.js, or files listed on the command line. Changes or ^C restart the server. This is most useful for running the server during development. Usage is:

$ ./serverloop.py DOCUMENT_ROOT [OTHER_FILES...]

Configuration

Woses can be configured by placing a file called .woses-conf.js in the document root. This file may export the following settings:

Here is an example configuration file:
exports.port = 80;
exports.index = "home.html";
exports.mimetypes = {
  'gif':  'image/gif',
  'readme': 'text/plain'
}

PHP

Woses will serve PHP scripts through the mechanism of the PHP command-line interface; thus the php command must be available for woses to serve PHP scripts.

The big caveat of PHP support is that, within PHP code, calls to `header()' have no effect.

JS RPC

Requests for filenames ending in -rpc.js (some more sensible mechanism to distinguish is a TODO item) are loaded as modules and the HTTP request is proxied through their exported fetch function, with signature:

exports.fetch = function(request, response) {
  // ...
  response.body = ...; 
  return response.respond();
};

JS Templating

Templating in the style of EJS / Resig's micro-templating is planned, but not implemented

Security

URLs with ".." in them are disallowed, but security is probably poor at the moment. That is, an attacker may be able to pwn your system if you are running this on a public server.

Tests

Test page.