I have db.json:
{
"posts": [{ id: 1, title: "My Awesome Post", key: "myawesomepost" }]
}
and routes.json:
{
"/posts/:key": "/posts?key=:key"
}
GET /posts/myawesomepost
works and I receive the result
DELETE /posts/myawesomepost
returns a 404
I realize now that /posts/1 would normally return a single result {...} where /posts?key=myawesomepost is going to return an array of results [{...}].
Is there a simple way to make DELETE work on a non-id property or must one use a middleware?
Most helpful comment
I realize now that
/posts/1would normally return a single result{...}where/posts?key=myawesomepostis going to return an array of results[{...}].Is there a simple way to make DELETE work on a non-id property or must one use a middleware?