RestRserve | R web API framework for building | REST library
kandi X-RAY | RestRserve Summary
kandi X-RAY | RestRserve Summary
RestRserve is an R web API framework for building high-performance AND robust microservices and app backends. With Rserve backend on UNIX-like systems it is parallel by design. It will handle incoming requests in parallel - each request in a separate fork (all the credits should go to Simon Urbanek).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of RestRserve
RestRserve Key Features
RestRserve Examples and Code Snippets
Community Discussions
Trending Discussions on RestRserve
QUESTION
I am currently creating a REST API with restrserve.
While trying to add a logger to my application I ran into this problem.
By setting the log level as: application$logger$set_log_level("error")
,
my console output on error has a JSON structure like:
ANSWER
Answered 2020-Oct-01 at 07:22QUESTION
This is the code for an app
...ANSWER
Answered 2020-Aug-02 at 16:24library(RestRserve)
app = Application$new()
app$add_get("/user/{id}", function(req, res) {
str(req$parameters_path)
}, match = "regex")
req = Request$new("/user/100500", method = "GET")
res = app$process_request(req)
#List of 1
# $ id: chr "100500"
QUESTION
Condider that I've built my application as in te example below:
...ANSWER
Answered 2020-Jul-29 at 17:11Looking at the source code I'd suggest adding the named parameter background=TRUE
to backend$start(app, http_port = 8080)
. This parameter is FALSE by default (line 36), when TRUE Rserve will be started in a new detached R-session (line 93). (Btw, leaving out said parameter you can check that the disconnect kills your running R-session by keeping a second SSH-connection open and listing running processes with a filter: ps aux | grep bin/exec/R
before and after the disconnect)
If using said parameter works you might also want to look into server restarts. From the looks of it I'd say RestRserve cannot actually handle that by itself and you might need a small service script.
QUESTION
How would one set up logging each request to a different json file with RestRserve
?
I tried using the lgr
package (referred to in RestRserve's doc on logging) like so:
ANSWER
Answered 2020-May-13 at 07:53I believe you even don't need any special logger - just use writeLines
. Also you can rely on req$id
to name files since it is unique.
QUESTION
I would like to work with RestRServe to have a .xlsx file uploaded for processing. I have tried the below using a .csv with success, but some slight modifications for .xlsx with get_file was not fruitful.
...ANSWER
Answered 2020-Apr-15 at 06:07What have you tried? According to the documentation request$get_file()
method returns a raw vector - a binary representation of the file. I'm not aware of R packages/functions which allow to read xls/xlsx file directly from the raw vector (probably such functions exist, I just don't know).
Here you can write body to a file and then read it normal way then:
QUESTION
I would like to expose an endpoint that accepts multipart/form-data, parses the multipart content and returns a csv-file. (the multipart input contains a csv dataset and processing instructions)
I’ve done this with plumber using Rook::Multipart$parse()
as suggested here. Because plumber doesn’t support parallel requests, I’d like to re-implement this with RestRserve. The following won’t work – plumber’s inputs are of class environment
(which Rook::Multipart$parse()
assumes) whereas RestRserve’s inputs are of class Request R6
.
ANSWER
Answered 2020-Mar-19 at 13:21RestRserve
parses multipart body when process the incoming request. As result you have a raw request$body
and metatdata in the request$files
. Request
object also provides a get_file
method to extract body content. Let me show example for the app and request:
QUESTION
I am trying out the very interesting package RestRserve from with RStudo server that I installed on an AWS instance.
This is de code I use:
...ANSWER
Answered 2020-Jan-26 at 08:46Likely you need two additional steps:
- make sure you allow traffic from internet to 8080 port
- make sure you use public IP (or better DNS) of your instance
QUESTION
I tried to implement charToRaw
function with Rcpp. C_charToRaw
below is copied from the R source.
C++ code:
...ANSWER
Answered 2019-Aug-13 at 12:26The overhead almost certainly comes from the Rcpp wrapper around your functions. As you can see from the generated code, this wrapper sets up an RNG scope, which involves copying a large-ish vector of numbers (in your case this is actually unnecessary; use [[Rcpp::export(rng = false)]]
to disable it). In the case of your Cpp_charToRaw
, the wrapper additionally needs to copy the R vector into a std::string
, since this conversion cannot happen in-place (it could with std::string_view
).
You can test this Rcpp overhead by benchmarking an empty Rcpp function:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install RestRserve
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page