Is it better to organize routes by controller or something 'restfulish'?

I’m having a hard time deciding on the best router design. I basically have three different major resources: sales order, purchase orders and manufacturing orders – abbreviated so, po and mo. And then each of these have three general views: overview, listing, and calendar, plus an individual record view. Btw, each of these views correspond to a controller, which turned out to be a great design decision.

So, should I organize the routes by controller too?

/overview/so            --> overview
/listing/so             --> listing view
/calendar/so            --> calendar view
/records/so/12345       --> record

Or should I use something a bit more “restfulish” and concise.

/so                  --> overview
/so/listing          --> listing view
/so/calendar         --> calendar view
/so/12345            --> record

Yes, naming is the hardest problem in software engineering – and by naming I mean routes :wink:

I like the second example more because it’s more traditional.

There are no RESTful[ish] routes because in REST routes doesn’t matter. REST APIs are hypertext driven.

1 Like

Thanks. I ended up using the second version as you suggested. Not only more traditional, but more concise – I let that be the deciding factor.