【发布时间】:2020-01-26 07:58:20
【问题描述】:
我正在使用安装在 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 浏览器说无法访问该站点。
我错过了什么吗?关于为什么这不起作用的任何想法?
【问题讨论】:
标签: r amazon-web-services api amazon-ec2 restrserve