Added routes parameter (#1341)

This commit is contained in:
Shahed Nasser authored and GitHub committed 2022-04-15 10:57:58 +02:00
1 parent 47e0de1a76
commit 1ebeb13441
2 files changed
+24

No files matched your search

@@ -204,6 +204,18 @@ const userService = req.scope.resolve("userService")
const user = await userService.retrieve(id) 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()
//...
}
```
## What’s Next 🚀 ## What’s Next 🚀
- [Learn how to add an endpoint for the Storefront.](/advanced/backend/endpoints/add-storefront) - [Learn how to add an endpoint for the Storefront.](/advanced/backend/endpoints/add-storefront)
@@ -175,6 +175,18 @@ const customerService = req.scope.resolve("customerService")
const customer = await customerService.retrieve(id) const customer = await customerService.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()
//...
}
```
## What’s Next :rocket: ## What’s Next :rocket:
- [Learn how to add an endpoint for the Admin.](/advanced/backend/endpoints/add-admin) - [Learn how to add an endpoint for the Admin.](/advanced/backend/endpoints/add-admin)