7rans
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 ![]()
Most Liked
krasenyp
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.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









