vibe.d in techempower web framework benchmark

1100110 1100110 at gmail.com
Thu Apr 25 02:26:16 PDT 2013


[diet.d]

import vibe.d;
import vibe.data.json;
import std.array;


shared static this()
{
    auto settings   	= new HttpServerSettings;
    auto router     	= new UrlRouter;
    settings.port   	= 8080;
    settings.hostName 	= "localhost";

	///Json Response
    router.get("/json", &handleJson );

    listenHttp(settings, router);
}


/// Json Response
void handleJson(HttpServerRequest req, HttpServerResponse res)
{
    Json tmp = serializeToJson(["message":"Hello, World!"]);
    res.writeBody(tmp.to!string, "application/json");

    /** Does this one still meet the qualifications,
     *  and which should be used?
     * res.writeJsonBody(["message":"Hello, World!"]);
     */
}



Someone Get Bearophile in here.  I bet he'll tell me _exactly_ what is
what with this.  =P


More information about the Digitalmars-d mailing list