Oh dear sorry ignore those last two posts! I just properly read the commends above and now understand about browser making the favicon.ico request. Will adjust to use the router correctly.

On Sat, 20 Feb 2016 23:55:39 GMT, Andrew Chapman wrote:

Note, I've tried this on both Windows and Linux / CentOS.

Cheers.

On Sat, 20 Feb 2016 23:54:30 GMT, Andrew Chapman wrote:

Actually, as far as I can tell all code is running twice.

I noticed the same thing when running a project using the latest release.

To demonstrate, if I create an empty vibed project using

dub init myproject -t vibe.d

and then alter the demo Hello function to have

import std.stdio;

and

writeln("hello there");

When i run it and pull the URL, I see "hello there" twice in the console.

Looks like a bug in the request handler?

Cheers.

On Fri, 19 Feb 2016 21:00:04 +0100, Sönke Ludwig wrote:

Am 17.02.2016 um 15:48 schrieb Louie Bacani Foronda:

On Tue, 16 Feb 2016 19:09:47 +0100, Sönke Ludwig wrote:

Am 16.02.2016 um 17:40 schrieb Louie Bacani Foronda:

(...)
It is definitely running twice, why is that?

The browser is probably requesting "/favicon.ico" in addition to "/".
Try to print req.requestURL to know for sure.

yep it is requesting favicon.ico, any fix for this? as almost all codes runs twice because of this...

There is no real "fix" for this, because the browser will just do that
no matter what, but you'd usually just restrict the code to run only for
a particular URL. The typical way for low-level code is to use a
URLRouter and then call router.get("/", &hello); and pass router
to listenHTTP. See also http://vibed.org/docs#http-routing.