A small web server written with PowerBASIC. Some of it's features:
static file | http://localhost/test.html | |
service | http://localhost/blue/gravy | |
url parameters | http://localhost/rnd/10/1/100 | |
mixed url parameters | http://localhost/rnd/10?from=1&to=100 | |
normal parameters | http://localhost/rnd?to=100&from=1&cnt=10 |
The ext directory has some example extensions. Essentially you write an exported function with the signature:
Function ProcessRequest ( verb As String, url As String, body As String, params As String, response As String, contentType As String ) As Long
verb is the http verb
url is the matching part of the url that invoked the service
params are any parameters including url parameters.
repsonse is where you put your response value
contentType is content type i.e. text/html.
return value is the http response code. Currently valid responses are 200 ok, 400 bad request, 404 not found, 415 unsupported media. Others can be added as needed.
The files directory tree is where you put static content. You can also add or remove content here using external applications, dynamic, or built-in extensions.