Added routes parameter (#1341)

This commit is contained in:
Shahed Nasser
2022-04-15 10:57:58 +02:00
committed by GitHub
parent 47e0de1a76
commit 1ebeb13441
2 changed files with 24 additions and 0 deletions
@@ -204,6 +204,18 @@ const userService = req.scope.resolve("userService")
const user = await userService.retrieve(id)
```
### Route Parameters
The routes you create receive 2 parameters. The first one is the absolute path to the root directory that your server is running from. The second one is an object that has your plugin's options. If your API route is not implemented in a plugin, then it will be an empty object.
```js
export default (rootDirectory, pluginOptions) => {
const router = Router()
//...
}
```
## Whats Next 🚀
- [Learn how to add an endpoint for the Storefront.](/advanced/backend/endpoints/add-storefront)