Hi,
I'm trying to make a REST API using vibe.d.
GET /resource to give me an array of resource available : it works
GET /resource/:id to give me a resource with matching id. It doesn't work and seems to register route to :id/resource instead. Is it possible to change this behavior ? How can I change this behavior without using UDA on all my API method ? Is there a reason behind that behavior ? The resource/:id seems more natural to me.
DELETE /resource/:id I have the same problem and the delete method is mapped to /:id/resource
POST /resource with value
{
"firstName": "demo",
"lastName": "toto"
}
failed.
I have an id in my struct and this seems to be mandatory. How is it possible to declare that fields of my struct are not mandatory.
POST /resource with value
{
"id": 33
"firstName": "demo",
"lastName": "toto"
}
failed.
It seems that the default behavior is waiting for something like :
{
"resource":
{
"id": -33,
"firstName": "demo",
"lastName": "toto"
}
}
Is there a way to change the behavior of vibe.d so the add method is mapped to something waiting for JSON value instead of a JSON object having a field matching the add method parameter ?
Here is a gist with the source code i'm using.
Thanks for your help,