Title: | Live Reload for Plumber APIs |
---|---|
Description: | Enhances development for plumber APIs by enabling live reloading. Monitors API files for changes and automatically refreshes the server and connected web clients, allowing for faster API iteration. |
Authors: | Elian Thiele-Evans [aut, cre] |
Maintainer: | Elian Thiele-Evans <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.0.0.9002 |
Built: | 2025-01-14 05:08:03 UTC |
Source: | https://github.com/ElianHugh/hotwater |
Following install_hotwater()
, the hotwater
command can be used
to run a hotwater engine straight from the terminal. See
run()
for further details on default values.
hotwater -v
will provide the current version of hotwater.
hotwater -h
will provide help text.
-f |
plumber file |
-d |
extra directories |
-p |
plumber port |
-h |
show help |
--host |
plumber host |
# ```sh # hotwater -f path/to/app.R -p 9999 # ```
# ```sh # hotwater -f path/to/app.R -p 9999 # ```
If hotwater is installed, users may run hotwater
from the command line
rather than from an R terminal.
install_hotwater(install_folder)
install_hotwater(install_folder)
install_folder |
folder to install hotwater
script into. To run as expected, make sure that the folder supplied is on your
|
hotwater::install_hotwater()
hotwater::install_hotwater()
Start the hotwater engine, launching a plumber API that is restarted whenever a file in the plumber API's folder is modified.
Extra directories can be specified to refresh the API when directories other than the plumber folder are modified.
If a plumber endpoint returns an HTML response, when hotwater refreshes the API, {hotwater} will also order a refresh of any webpage that is using the API.
run(path, dirs = NULL, port = NULL, host = NULL, ignore = NULL)
run(path, dirs = NULL, port = NULL, host = NULL, ignore = NULL)
path |
path to plumber API file. |
dirs |
(optional) a character vector of extra directories to watch for file changes. Paths are resolved from the current working directory, not the directory of the plumber API file. |
port |
[default port can either be set explicitly, or it defaults to the
|
host |
[default "127.0.0.1"] host to launch API on. host can either be set explicitly, or it defaults to the
|
ignore |
[default |
To refresh the browser, a postserialize plumber::pr_hook is used to inject a websocket into the HTML client that listens for the plumber server refresh.
plumber::options_plumber, plumber::get_option_or_env, plumber::serializer_html
# start a hotwater session on port 9999 hotwater::run( path = system.file("examples", "plumber.R", package = "hotwater"), port = 9999L )
# start a hotwater session on port 9999 hotwater::run( path = system.file("examples", "plumber.R", package = "hotwater"), port = 9999L )
Uninstall global hotwater script
uninstall_hotwater(install_folder)
uninstall_hotwater(install_folder)
install_folder |
folder to uninstall hotwater from. |
hotwater::uninstall_hotwater()
hotwater::uninstall_hotwater()