Perhaps my google skills are failing me, but is there a way to access path variables in a REST service?
shared static this() {
auto resource = new SequenceResource;
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["::1", "127.0.0.1"];
auto router = new URLRouter;
registerRestInterface!FairService(router, resource);
listenHTTP(settings, router);
}
interface FairService {
@method(HTTPMethod.GET) @path("hash/:id") string test();
}
class SequenceResource : FairService {
string test() {
// How to get path variable here?!
return "Test: ";
}
}
(Btw, it took me a while to figure out that I needed an interface and use the templated form of registration in order to get the "method" and "path" attributes working for a REST service. It could be a bit clearer in the docs.)