Skip to content

Commit

Permalink
Add details about named functions as router modifiers (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
blairj09 committed Sep 7, 2021
1 parent 85a7f99 commit 89b9730
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion vignettes/annotations.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ pr() %>%

Annotation | Arguments | Description/References
-----------| --------- | ----------------------
`@plumber` | None | Modify plumber router from plumber file. The plumber router provided to the function **must** be returned.
`@plumber` | None | Modify plumber router from plumber file. The plumber router provided to the function **must** be returned. In most cases, anonymous functions are used following the `#* @plumber` annotation. However, named functions can also be used. When a named function is used, it must be referenced without parentheses.

##### Annotations example

Expand All @@ -228,6 +228,16 @@ function(pr) {
pr_set_debug(TRUE) %>%
pr_set_docs("swagger")
}
# Named function
debug_swagger <- function(pr) {
pr %>%
pr_set_debug(TRUE) %>%
pr_set_docs("swagger")
}
#* @plumber
debug_swagger
```

##### Equivalent programmatic usage
Expand Down

0 comments on commit 89b9730

Please sign in to comment.