Need help with delegates and vibed

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 19 12:53:01 PDT 2016


Thanks! I am understand a little bit better, but not all.

```
shared static this()
{
	auto settings = new HTTPServerSettings;
	settings.port = 8080;

	listenHTTP(settings, &handleRequest);
}

void handleRequest(HTTPServerRequest req,
                    HTTPServerResponse res)
{
	if (req.path == "/")
		res.writeBody("Hello, World!", "text/plain");
}
```
https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/http/server.d#L104
I expected to see in listenHTTP() function some processing but 
it's simply get args and then do return:
return listenHTTP(...)

Could you explain why it's do so?

--
Where is constructor of this class? 
http://vibed.org/api/vibe.http.client/HTTPClientRequest

How I should use it if have only docs, and do not have examples? 
(I am trying understand how to use docs without cope-past 
examples)


More information about the Digitalmars-d-learn mailing list