I cannot get functions from another (sourced) file to be accessible through the API.
My setup is very basic:
main.R:
source("./functions.R")
#* Echo back the input
#* @param msg The message to echo
#* @get /echo
function(msg=""){
list(msg = paste0("The message is: '", msg, "'"))
}
functions.R:
print("I am sourced")
#* Return "hello world"
#* @get /hello
function(){
"hello world"
}
When I run:
r = plumb("main.R")
I get expected output:
[1] "I am sourced"
Then I run:
r$run(port=8000)
And the /echo endpoint is accessible, but the /hello one is not, returning 404 - Resource Not Found.
Any idea, how to include the file properly to get it accessible through the API?