Am 12.03.2015 um 19:46 schrieb Marc Schütz:
Is there a way to tell the
registerRestInterface
not to append
trailing slashes to paths specified with@path
?interface APIv1 {
@property APIv1Countries countries();
}
interface APIv1Countries {
import vibe.web.rest; @path("/") @property Bson get(); @path("/") @property Bson get(string id);
}
This produces the following routes:
REST route: GET /v1/countries/ []
REST route: GET /v1/countries/:id/ []But what I want is:
REST route: GET /v1/countries/ []
REST route: GET /v1/countries/:id []I also tried
@path("")
, to no avail.
You can achieve this by avoiding the "id" parameter special case and
using a fully qualified path instead:
@path("/:id") @property Bson get(string _id);
(note the underscore before "id")