79706122

Date: 2025-07-18 11:49:22
Score: 3.5
Natty:
Report link

I'm working on defining routes in CodeIgniter 4 and want to confirm the best professional way to structure the routes, especially when using both POST and GET methods for editing and deleting records.

If both actions (edit and delete) are using the POST method, this is a alternative way to define a routes I’m using:

$routes->post('admin/news/edit/(:any)', 'Admin_news::edit/$1');

$routes->post('admin/news/delete/(:any)', 'Admin_news::delete/$1');

Alternatively, if the delete method is accessed via GET, then:

$routes->get('admin/news/delete/(:any)', 'Admin_news::delete/$1');

Please let me know if this approach is acceptable and follows best practices, or if there are any recommended improvements for cleaner or more secure route definitions.

Reasons:
  • RegEx Blacklisted phrase (2.5): Please let me know
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: venkata nikitha