RejectedSoftware Forums

Sign up

Failed to listen for incoming HTTP connections

import vibe.d;
import std.stdio;
import std.file;

interface API
{
	string getSomeInfo();
}

class Example1 : API
{
	string getSomeInfo()
	{
		return "Some Info!";
	}
}

shared static this()
{

	auto settings = new HTTPServerSettings;
	settings.port = 8080;

	auto router = new URLRouter();
	listenHTTP(new HTTPServerSettings(), router);

	registerRestInterface(router, new Example1());

}

\vibe\http\server.d(188): Failed to listen for incoming HTTP connections on any of the supplied interfaces.
Error executing command run:
Program exited with code 1

Re: Failed to listen for incoming HTTP connections

Oh, I understood. right code is:

shared static this()
{

	auto settings = new HTTPServerSettings;
	settings.port = 8080;

	auto router = new URLRouter();
	listenHTTP(settings, router);

	registerRestInterface(router, new Example1());

}