0.0.13 • Published 10 years ago

tffileserver v0.0.13

Weekly downloads
54
License
-
Repository
-
Last release
10 years ago

TF-FileServer

Provides files over HTTP. Also packages CSS and JS via TF-CSS and Browserify and allows callbacks for HTTP paths.

Example Usage

var fileserver = require('tffileserver');

// The first parameter is the path to files loaded into memory on boot.
// The second parameter is the path to files read from the hard drive for each request.
var server = fileserver.init(null, './www');

// We compile `index.js` using browserify and serve it over http at the path /bundle.js
fileserver.compileJavascript('./client_scripts/index.js', '/bundle.js');

// We combine css files using tfcss and serve the result over http at the path /style.css
fileserver.compileCSS('./client_styles/config.json', '/style.css');

fileserver.addAction('/test', function(req, resp) {
	resp.writeHead(200, {'Content-Type': 'application/json'});
	resp.end({'message': 'Hello World'});
});

server.listen(8080);

Note that req in the addAction callback would contain the following if the user request the page www.example.com/test.json?id=32&validate:

{
	"extension": "json",
	"filename": "/test.json",
	"parameters": {
		"id": "32",
		"validate": true
	}
}
0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

11 years ago

0.0.10

11 years ago

0.0.9

11 years ago

0.0.8

11 years ago

0.0.7

11 years ago

0.0.6

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago