Hive
A super-lightweight microservice (toy) framework written in Rust. It uses Lua as interface to provide simple, fun developing experience and fast deployment. It is currently under heavy development, and many functionalities are yet to be implemented.
Get Started
Service file:
hive.name = "hello"
local function hello(req)
local name = req.params.name or "world"
return { greeting = "Hello, " .. name .. "!" }
end
register("/", hello)
register("/:name", hello)
Run server:
$ cargo run --release
INFO hive > Access key: *your-access-key*
INFO hive > Server is running at http://127.0.0.1:3000
Upload service:
$ curl 127.0.0.1:3000/upload -F "code=@/path/to/service/file.lua" -H "Hive-Access-Key: *your-access-key*"
Get greetings:
# '%' indicates that there is no line break at the end of the body. It is not
# present in actual body.
$ curl 127.0.0.1:3000/hello
{"greeting":"Hello, world!"}%
$ curl 127.0.0.1:3000/hello/Eric
{"greeting":"Hello, Eric!"}%
Lua version compatibility
Hive uses LuaJIT as default, and is compatible with Lua 5.4, 5.3, 5.2 and 5.1.
You can build Hive with other versions of Lua using the following command:
$ cargo build --no-default-features --features lua{jit|54|53|52|51}
License
Hive is licensed under the MIT License.