项目
在 GitHub 查看
ambiorix-web/ambiorix
关于
🖥️ Web framework for R
网站与应用开发实测星标增长
- 24小时
- +1
- 7天
- +1
- 15天
- +1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文ambiorix
Website | CLI | Generator | Docker | Load Balancer
Web framework for R based on httpuv and inspired by express.js.
Install
The stable version is available on CRAN with:
install.packages("ambiorix")
You can also install the development version from Github:
remotes::install_github("ambiorix-web/ambiorix")
Example
A minimal server:
library(ambiorix)
app <- Ambiorix$new(port = 3000L)
app$get("/", function(req, res) {
res$send("Hello, World!")
})
app$start()
Run it, then open http://localhost:3000.
Websites and APIs use the same syntax, so one app can serve both:
library(ambiorix)
app <- Ambiorix$new(port = 3000L)
# middleware runs before every route's handler
app$use(function(req, res) {
req$received_at <- Sys.time()
})
# serves index.html from the same directory
app$get("/", function(req, res) {
res$send_file("index.html")
})
# path parameters
app$get("/users/:id", function(req, res) {
res$json(list(id = req$params$id))
})
# POST with a JSON body
app$post("/users", function(req, res) {
body <- req$parse_json()
res$json(list(created = body))
})
app$start()
See the docs for more.
Middlewares
- druid Logger
- alesia Minifier
- eburones Sessions
- agris Security
- scilis Cookies
- titan Prometheus metrics
- surf CSRF protection
- signaculum favicon
- pugger Pug engine
- jader Jade engine
Tools & Extensions
- belgic Load balancer
- packer JavaScript
- CLI for generator
- Generator Project generator
- Docker Docker image
Contributing
Please note that the ambiorix project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
探索相关项目
加载中…