我正在使用安装在 AWS 实例上的 RStudo 服务器尝试非常有趣的软件包RestRserve 。
这是我使用的解码代码:
library(RestRserve)
app = Application$new()
app$add_get(
path = "/hello",
FUN = function(request, response) {
response$set_body("Hello from RestRserve")
})
backend = BackendRserve$new()
backend$start(app, http_port = 8080)
我认为该应用程序已启动并正在运行,消息似乎正确:
{"timestamp":"2020-01-26 07:42:30.957686","level":"INFO","name":"Application","pid":1872,"msg":"","context":{"http_port":8080,"endpoints":{"HEAD":"/hello","GET":"/hello"}}}
-- running Rserve in this R session (pid=1872), 2 server(s) --
(This session will block until Rserve is shut down)
但是,当我尝试使用这样的实例的 IP 地址访问应用程序时:http://35.180.45.129/hello浏览器说无法访问该站点。
我错过了什么?关于为什么这不起作用的任何想法?