0.0.0-14 • Published 10 years ago

resource-tree v0.0.0-14

Weekly downloads
3
License
BSD
Repository
bitbucket
Last release
10 years ago

resource-tree

A useful separation of lookup (URL parsing/routing) and resources for implementing a HTTP server.

Installation: npm install resource-tree

Small example:

var resource_tree = require('resource-tree');

var root = {
    // Assuming "example.js" exists in the same directory as this script
    'example.js': new resource_tree.FileResource(require('path').join(__dirname, 'example.js'))
};

resource_tree.createServer(root).listen(8080, "127.0.0.1");

console.log("Now you can GET http://127.0.0.1:8080/example.js");
console.log("Everything else is properly handled as 404 (Not Found) or 405 (Method Not Allowed)");

Examples by use-case:

0.0.0-14

10 years ago

0.0.0-13

11 years ago

0.0.0-12

11 years ago

0.0.0-11

11 years ago

0.0.0-10

11 years ago

0.0.0-9

11 years ago

0.0.0-8

11 years ago

0.0.0-7

11 years ago

0.0.0-6

11 years ago

0.0.0-5

11 years ago

0.0.0-4

11 years ago

0.0.0-3

11 years ago

0.0.0-2

11 years ago

0.0.0-1

11 years ago

0.0.0

11 years ago