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.
$ node woses.js DOCUMENT_ROOTwill 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...]
Woses can be configured by placing a file
called .woses-conf.js
in the document root. This file may
export the following settings:
port
: A port other than the default 8080 on which to
serve.
index
: Name of a directory index page to use for
URI's which point to a folder, rather than the
default, index.html
falling back
to index.php
.
mimetypes
: A map from file extensions to MIME types
for serving content.
exports.port = 80; exports.index = "home.html"; exports.mimetypes = { 'gif': 'image/gif', 'readme': 'text/plain' }
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.
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(); };
Templating in the style of EJS / Resig's micro-templating is planned, but not implemented
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.