Phoenix.Router.resources/4

Parsed documentation:
View on GitHub
Defines "RESTful" routes for a resource.

The given definition:

    resources "/users", UserController

will include routes to the following actions:

  * `GET /users` => `:index`
  * `GET /users/new` => `:new`
  * `POST /users` => `:create`
  * `GET /users/:id` => `:show`
  * `GET /users/:id/edit` => `:edit`
  * `PATCH /users/:id` => `:update`
  * `PUT /users/:id` => `:update`
  * `DELETE /users/:id` => `:delete`

## Options

This macro accepts a set of options:

  * `:only` - a list of actions to generate routes for, for example: `[:show, :edit]`
  * `:except` - a list of actions to exclude generated routes from, for example: `[:delete]`
  * `:param` - the name of the paramter for this resource, defaults to `"id"`
  * `:name` - the prefix for this resource. This is used for the named helper
    and as the prefix for the parameter in nested resources. The default value
    is automatically derived from the controller name, i.e. `UserController` will
    have name `"user"`
  * `:as` - configures the named helper exclusively
  * `:singleton` - defines routes for a singleton resource that is looked up by
    the client without referencing an ID. Read below for more information

## Singleton resources

When a resource needs to be looked up without referencing an ID, because
it contains only a single entry in the given context, the `:singleton`
option can be used to generate a set of routes that are specific to
such single resource:

  * `GET /user` => `:show`
  * `GET /user/new` => `:new`
  * `POST /user` => `:create`
  * `GET /user/edit` => `:edit`
  * `PATCH /user` => `:update`
  * `PUT /user` => `:update`
  * `DELETE /user` => `:delete`

  Usage example:

    `resources "/account", AccountController, only: [:show], singleton: true`
Suggestions:
Please help! Open an issue on GitHub if this assessment is incorrect.