On Thu, 14 May 2015 20:01:29 GMT, Suliman wrote:
I am trying to strip REST example to get it's minimal version to better understand how it's work.
import vibe.d; import std.stdio; import std.file; class Example1 { string getSomeInfo() { return "Some Info!"; } } shared static this() { auto router = new URLRouter; registerRestInterface(router, new Example1()); auto routes = router.getAllRoutes(); auto settings = new HTTPServerSettings; settings.port = 8080; assert (routes[0].method == HTTPMethod.GET && routes[0].pattern == "/example1_api/some_info"); }
The problem that I can't compile it.
The problem is that you didn't specify the API interface.
If you take a look at the examples ( https://github.com/rejectedsoftware/vibe.d/blob/master/examples/rest/source/app.d#L50 ), you'll see that every class inherit from an interface.
In your case, a simple "interface IAPI { string getSomeInfo(); }" will do.
I'll add a check for this error.