inst/templates/inst/endpoints/plumber-utility.R

################################################################################
## plumber utility endpoint
################################################################################
# Utilities ---------------------------------------------------------------
#* Health check
#* Respond when you ask it if a service is available.
#* @serializer unboxedJSON list(na = NULL)
#* @get healthcheck
function(){
    message("--> healthcheck: Request Received")
    return(NULL)
}

#* Reflect the input class
#* Return the class of the input.
#* @serializer unboxedJSON list(na = NULL)
#* @post class
function(req){
    message("--> class: Request Received")
    json <- req$postBody
    x <- json |> jsonlite::fromJSON(flatten = TRUE)
    return(class(x))
}

Try the microservices package in your browser

Any scripts or data that you put into this service are public.

microservices documentation built on Oct. 1, 2022, 5:07 p.m.