isteves / plumbplumb

Faster iteration with plumber
14 stars 0 forks source link

start_plumber stucked while starting with package code, but running when copying methods #1

Open lpalomerol opened 3 years ago

lpalomerol commented 3 years ago

Thanks for doing this package, it would be very helpfull when testing my new plumber API.

I've downloaded it using devtools and prepared a simple code snippet to run my plumber api located at api.R path:


path =here::here("api.R")
port = 8484
term_id = plumbplumb::start_plumber(path, port)

bar = GET(sprintf('http://127.0.0.1:%s/status/health', port))
content(bar)

When I run this code it crashes at stop("Check terminal") line... but if I copy the three methods inside my script and execute them it runs correctly.

Do you have any idea about what could be the reason? I would like to use your package in our environment instead of copying/pasting the methods

pep1024 commented 2 years ago

In the new versions of plumber, when the API is run with plumber::plumb(...) the message "Starting server to listen on port" is not shown anymore. Instead, the message

> Running plumber API at http://127.0.0.1:8000"

> Running swagger Docs at http://127.0.0.1:8000/__docs__/

is shown.

To fix the issue, just change the line in function start_plumber(): check_output(trml, "Starting server to listen on port") by this one check_output(trml, "Running plumber API")