Download Compaq`s Web Language A Programming Language for the Web
Transcript
Module WebServer
Module WebServer
The WebServer module exports an interface to a simple multi-threaded web server.
The Start function allows the programmer to start the web server on a specific port
on the host machine where WebL is running. After starting the web server, HTML
and other files will be served from the fileroot directory indicated when the server
was started. The programmer may publish WebL functions to be executed when
specific URL paths are requested.
For example, the following program starts the web server on port 90, and publishes
a function called Echo that returns an HTML page. Afterwards, its goes to sleep
while requests are serviced. If a request for the URL /bin/echo is received by the
server, the Echo function is invoked.
import
WebServer;
WebServer_Start("c:\\InetPub\\wwwroot", 90);
var Echo = fun(req, res)
res.result = “<html><body>Hello!</body></html>”;
end;
WebServer_Publish("/bin/echo", Echo);
while true do
Sleep(10000)
end
WebL - A Programming Language for the Web
143