node package manager


Extremely simple http server


Simple, semi-static, http server. Mostly the result of my playing around with the http and fs modules, but it may serve someone.

Install from npm:

npm install just-http

Create a new server:

var server = require("just-http").createServer();

Map path to files using regular expressions:"^/$", "./www-test/index.html");"^/(.+)$", "./www-test/$1");

Map a path to a function, to serve dynamic content:"^/dynamic$", function (request, response) {
    try {
        // TODO : do something smart
    } catch (e) {
        // never let exceptions bubble up
        server.sendError(response, e);

Start listeneing


github repository: