kramer65
kramer65

Reputation: 54013

How to structure urls with backbone.js?

I'm building a ticketing system website in Backbone.js. I now need to get a collection of messages belonging to one ticket. At first I thought of the obvious route '/ticket/:id'. Unfortunately, this already returns the ticket itself (creation date and which supporter was assigned to it). For this reason I need a different route.

A second logical option would be '/message/:id', but of course this refers to the individual message of a certain id.

So my question is: which route or url would you think is logical (keeping in mind the Backbonejs way of doing things) for getting all messages belonging to a certain ticket id? All tips are welcome!

Upvotes: 0

Views: 49

Answers (1)

Ming Chan
Ming Chan

Reputation: 1958

If you try to model a collection of messages belongs to a ticket, you should use:

/tickets/:id/messages/

Upvotes: 1

Related Questions