I started this project because I wanted a solution like [ExpressJS](http://expressjs.com/de/) but hybrid (for iOS and Android). I didn't want to build two native applications which each serve a backend (two codebases are just bah!). So this is the solution to create a Webserver which can receives HTTP Requests and responds with HTTP Responds.
Everytime a request will be received by the webserver your callback function will be called. In this case you are thinking right! You have to define onRequest BEFORE your start your server. I think it would work also after the start() but I didn't tested it yet.
If you received a request you will probably send a response "*cough*"...
We need to add a requestId param to map a response to a request, because internally the webserver will wait for the response. (Yes currently the webserver will wait until there aren't computers anymore on earth).
The params have to look like this (there are not default values for the params!):
This method allows sending file content in response to an http request. It is intended that this would be used in conjunction with cordova-plugin-file to locate the path of the file data to be sent.
The response object should look like this. Here, the provided path should be accessible by your cordova app and the type should be the mime type of the file. Note that the MIME type of the file can be found from the [.type property of the File object](https://developer.mozilla.org/en-US/docs/Web/API/File).