You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, can you explain what do you mean by example? Because you have routes that use both :name & :id like these ones:
r.Methods(http.MethodGet).Use(mw.Log, mw.Recovery).Handler(/posts/tags/:name, postController.IndexByTag())
r.Methods(http.MethodGet).Use(mw.Log, mw.Recovery, mw.Auth).Handler(/private/tags/:id, tagController.ShowPrivate())
Paths with the prefix /private (ex. /private/tags/:id) are assumed to be APIs that can only be used by administrators.
This kind of API is essentially identity-based.
On the other hand, other routes (ex. /posts/tags/:name) are assumed to be public APIs that anyone can use.
I would like to unify all of these routes to be ID-based.
In other words, I want all name-based (paths that include :name) to be ID-based (:id).
ex. /posts/tags/:name → /posts/tags/:id
There are some that include :title in the path, but I'm thinking of including it in the name base as well.
:id, :name, :title, etc. are all named in relation to the columns of the table. Making it ID-based means that you refer to the data by the ID of the table.
I believe that if it is name-based, it is likely to change, so I would like to use an ID that is less likely to change.
P.S.
Names are likely to change, so being indexed is inconvenient because name changes affect them.
Please forget this explanation for now. That was an incorrect sentence.
I want to change the url to be ID-based instead of name-based.
Names are likely to change, so being indexed is inconvenient because name changes affect them.The text was updated successfully, but these errors were encountered: