HelloWordl in Webserver
Adam D. Ruppe
destructionator at gmail.com
Sat Mar 17 13:18:38 PDT 2012
On Saturday, 17 March 2012 at 20:08:24 UTC, Xan wrote:
> I'm convinced there is a D equivalent?
It all depends on the library. If you use my code
https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff
It looks like this:
==
import arsd.cgi;
void hello(Cgi cgi) {
cgi.write("Hello, world!");
}
mixin GenericMain!hello;
==
You can build that as a cgi app to drop into any
web server, a FastCGI app to use a longer running
process on almost any webserver, or a HTTP server,
standalone.
Get cgi.d from my github then
dmd hello.d cgi.d # builds cgi version
dmd hello.d cgi.d -version=fastcgi # fastcgi, you also need the
Fast CGI C library from the internet (search for libfcgi)
or get netman.d and httpd.d and
dmd hello.d cgi.d netman.d httpd.d -version=embedded_httpd #
standalone, only works on linux
More information about the Digitalmars-d-learn
mailing list