mirror of
https://github.com/strapi/strapi.git
synced 2025-09-01 04:42:58 +00:00
Add policies information to routing and link controllers to routing docs (#8445)
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
This commit is contained in:
parent
ef710166df
commit
c86d5d274e
@ -316,7 +316,7 @@ Every action receives a `context` (`ctx`) object as first parameter containing t
|
||||
|
||||
### Example
|
||||
|
||||
In this example, we are defining a specific route in `./api/hello/config/routes.json` that takes `Hello.index` as handler.
|
||||
In this example, we are defining a specific route in `./api/hello/config/routes.json` that takes `Hello.index` as handler. For more information on routing, please see the [Routing documentation](./routing.md)
|
||||
|
||||
It means that every time a request `GET /hello` is sent to the server, Strapi will call the `index` action in the `Hello.js` controller.
|
||||
Our `index` action will return `Hello World!`. You can also return a JSON object.
|
||||
@ -329,7 +329,10 @@ Our `index` action will return `Hello World!`. You can also return a JSON object
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/hello",
|
||||
"handler": "Hello.index"
|
||||
"handler": "Hello.index",
|
||||
"config": {
|
||||
"policies": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -49,6 +49,10 @@ You have to edit the `routes.json` file in one of your APIs folders (`./api/**/c
|
||||
- `config`
|
||||
- `policies` (array): Array of policy names or paths ([see more](./policies.md))
|
||||
|
||||
::: tip
|
||||
You can exclude the entire `config` object if you do not want the route to be checked by the [Users & Permissions plugin](../plugins/users-permissions.md).
|
||||
:::
|
||||
|
||||
## Dynamic parameters
|
||||
|
||||
The router used by Strapi allows you to create dynamic routes where you can use parameters and simple regular expressions. These parameters will be exposed in the `ctx.params` object. For more details, please refer to the [PathToRegex](https://github.com/pillarjs/path-to-regexp) documentation.
|
||||
|
Loading…
x
Reference in New Issue
Block a user