A RESTful url should represent a thing, not an action. We want to avoid putting any verbs in the name of the url. Instead, the action should be defined by the HTTP method. For example:
// Bad GET http://example.com/get-users GET http://example.com/update-user?name=bob // Good GET http://example.com/users PUT http://example.com/users/u/bob
Of course, a "resource" can just as easily be a more abstract concept, like a component of a web page:
This might seem to contradict what we just said, which is not to use verbs in our urls. However in this case, "create" isn't referring to the client's action, but to the resource itself. We're getting the "create user" modal, so
modals/users/create is the resource name, and our action is
UserFrosting uses a specific naming scheme for endpoints, which we would encourage you to stick with when you start to develop your own endpoints.
Here's an example of routes used by UserFrosting :
||Load an admin page that contains a list of users|
||Load an admin page that contains a single user|
||Get a list of users and their information, as a JSON object|
||Get a single user's information as a JSON object|
||Create a new user|
||Update an existing user|
||Update specific field for an existing user|
||Delete an existing user|
||Delete all users|
||Get an "edit user" modal HTML fragment|
/api/users/u/bobcan be used to retrieve, update, or delete Bob's account depending on which HTTP verb we are using.
route:listBakery Command will display the full list of provided routes.