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.