CRUD to nested end points

I have this API end points

GET /posts
GET /posts/:id
GET /posts/:post_id/comments
POST /posts/:post_id/comments
GET /posts/:post_id/comments/:id
PUT /posts/:post_id/comments/:id
DELETE /posts/:post_id/comments/:id

I have the ember models post and comment and i want all the requests from the comment model to be proper for my API. Ιs there a way to do this?

1 Like

You can pass comments parameter in post JSON as a url, and define the relation as hasMany with async: true.

Or you can override buildURL function in the comments adapter to be how you want it. But i think the problem here would be passing the post_id