How D may replace PHP & ASPX on the Web!!!

Adam D. Ruppe destructionator at gmail.com
Wed Jul 27 10:52:38 PDT 2011


Robert McGinley wrote:
> That is a framework that is an http server
> with url mapping instead of a cgi library.

You should take a look at the zip in my last post:

http://arsdnet.net/apidemo.zip

The way my web.d works is it builds on top of cgi.d to do that
url to object mapping.

class SiteDemo : ApiProvider {
    // found at /
    Document _defaultPage() {... }
    // this method is at /hello
    string hello(string name) { return "hello, " ~ name; }
    // this object is at /SomeObject/ID
    class SomeObject : ApiObject { this(SiteDemo a, string id) {} }
    // this is at /SubObject/
    class SubObject : ApiProvider {}
}



cgi.d is actually more than just cgi - it also works fine with
fastcgi or an embedded http server. (the embedded needs add
on modules netman.d and httpd.d from http://arsdnet.net/dcode
them compile with -version=embedded_httpd  My httpd.d is single
threaded though, so I don't recommend using it in production
at this time.

But, if you deploy on Apache or IIS, it's easy to do that, and
just a recompile to switch backends later if you want. Don't
have to edit your app.)


More information about the Digitalmars-d mailing list