httpd
Provides an HTTP server written in JavaScript for the Mozilla platform, which can be used in unit tests.
The most basic usage is:
| 1 2 3 4 5 6 | var{startServerAsync} = require("httpd");varsrv = startServerAsync(port, basePath);require("unload").when(functioncleanup() {  srv.stop(function() { // you should continue execution from this point.  })}); | 
This starts a server in background (assuming you're running this code in an 
application that has an event loop, such as Firefox). The server listens at 
http://localhost:port/ and serves files from the specified directory. You 
can serve static content or use
SJS scripts,
as described in documentation 
on developer.mozilla.org.
You can also use nsHttpServer to start the server manually:
| 1 2 3 | var{nsHttpServer} = require("httpd");varsrv = newnsHttpServer();// further documentation on developer.mozilla.org | 
See HTTP server for unit tests for general information.
