Web servers in D

Adam D. Ruppe destructionator at gmail.com
Mon May 14 07:43:23 PDT 2012


On Monday, 14 May 2012 at 14:23:47 UTC, Andrea Fontana wrote:
> You just need "web.d" file you can find on github.

cgi.d is the one for a basic server.

https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff

If you use cgi.d alone, you can use the little 
-version=embedded_httpd
built in webserver to get started.

==
import arsd.cgi;

void requestHandler(Cgi cgi) {
    cgi.write("hello, world!");
}

mixin GenericMain!requestHandler;
==

dmd myapp.d arsd/cgi.d -version=embedded_httpd
./myapp

then go to http://localhost:8080/



It doesn't have great performance under heavy load though!


More information about the Digitalmars-d mailing list