VibeD - RestInterfaceClient - non-constant expression

holo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 24 10:38:53 PDT 2017


Hello

I'm trying to move forward with my code from here: 
https://forum.dlang.org/post/yftgpzlotuqzechcntvj@forum.dlang.org

I create my client app and trying to use RestInterfaceClient to 
connect to my api. Here is my present code for client:

module sites.frontpage;


import vibe.d;
import msfrontpage;

final class SilesianCloud {

   private:
   auto api = new 
RestInterfaceClient!IfFrontPageAPI("http://127.0.0.1:8090/api/");

   public:
	// GET /
	void get()
	{
                 Json result = api.getHome();
                 logInfo(result.toString);
		render!"frontpage.dt";
	}
}

When i try to compile it im getting:

../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/http/server.d(286,33): Deprecation: alias diet.traits.FilterCallback is deprecated - Use SafeFilterCallback instead.
Compiling Diet HTML template frontpage.dt...
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/inet/url.d(61,18): Error: non-constant expression "http://127.0.0.1:8090/api/"[0..4]
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/inet/url.d(129,15): Error: non-constant expression "http://127.0.0.1:8090/api/"[21..26]
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/inet/url.d(123,23): Error: non-constant expression "http://127.0.0.1:8090/api/"[7..16]
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/web/internal/rest/common.d(136,29): Error: non-constant expression ['h', 't', 't', 'p', ':', '/', '/', '1', '2', '7', '.', '0', '.', '0', '.', '1', ':', '8', '0', '9', '0', '/', 'a', 'p', 'i', '/', 'a', 'p', 'i'][0..29]
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/web/internal/rest/common.d(156,46): Error: non-constant expression ['h', 'o', 'm', 'e'][0..4]
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/web/internal/rest/common.d(156,46): Error: non-constant expression ['h', 'o', 'm', 'e'][0..4]
dmd failed with exit code 1.

What did i miss? I was trying to do it according to vibed 
documentation: 
http://vibed.org/api/vibe.web.rest/RestInterfaceClient


More information about the Digitalmars-d-learn mailing list