Routes: Which style is "better"? |
Since explicit routing became the recommendation a while back, I have wondered about the style of the route. Is there a "best practice"? Or is just developer preference?
Running CI 4.3.3 if it matters. To illustrate, let's assume we have some controller ("lists") with a home page, an add record, an edit record and a report (super simple example, not real world). Is one of these better than the other? Code: $routes->match(['get', 'post'], 'lists/', 'Lists::index'); versus Code: $routes->match(['get', 'post'], 'lists/', 'Lists::index'); With the various controls in my current project and being explicit for each function/page (like the first example), my routes file is now almost 650 lines. It can get confusing at times. Some of that is for various user permissions levels, but still quite long and could be cut by 75% going the other way I imagine. I guess the root question is, "Is it better to be explicit for security or some other reason or is simple ok?". Thanks |
Messages In This Thread |
Routes: Which style is "better"? - by SoccerGuy3 - 12-27-2023, 11:55 AM
RE: Routes: Which style is "better"? - by InsiteFX - 12-27-2023, 09:38 PM
RE: Routes: Which style is "better"? - by demyr - 12-28-2023, 01:47 AM
RE: Routes: Which style is "better"? - by SoccerGuy3 - 12-28-2023, 07:33 AM
RE: Routes: Which style is "better"? - by kenjis - 12-28-2023, 05:17 PM
RE: Routes: Which style is "better"? - by demyr - 12-29-2023, 02:43 AM
RE: Routes: Which style is "better"? - by lazcorp - 12-29-2023, 05:18 AM
RE: Routes: Which style is "better"? - by Derrick Vaillancourt - 01-10-2024, 04:42 AM
RE: Routes: Which style is "better"? - by bekeanloise - 02-01-2024, 07:57 PM
RE: Routes: Which style is "better"? - by mickmartin - 05-07-2024, 02:37 AM
|