On Thursday, 30 June 2016 at 00:10:54 UTC, ketmar wrote:
Adam's cgi.d from arsd repo[1] contains built-in server implementation too, it as one of the available options.

Indeed. To use this, download cgi.d:

https://raw.githubusercontent.com/adamdruppe/arsd/master/cgi.d

then make a program like:


import arsd.cgi;

void hello(Cgi cgi) {
   cgi.write("Hello!");
}

mixin GenericMain!hello;


and compile:

dmd yourfile.d cgi.d -version=embedded_httpd


And you can run the program `yourfile` and it listens on port 8085 by default, or change it at runtime like `./yourfile --port 5000` then go to `http://localhost:5000/` in your browser.

Reply via email to