DEV Community


Discussion on: Design an easy to use and flexible REST API

khalyomede profile image
Khalyomede Author • Edited

I like this suggestion! I am used to matching the name of my routes to the table it corresponds, because Laravel's router will generate the routes for you like this:

Route::resource("user", "UserController");

This will automatically create these routes for you:

Route::get("/user", "UserController@index");
Route::get("/user/{id}", "UserController@show");

// ...

I guess it is a matter of habit for me 😅 Anyway, I think using /api/users for the list of users makes a lot more sense for routes that are served to end users, so good point here!