Built with Rust, Astra delivers unmatched performance, fault-tolerance and ease-of-use for your Lua servers
Engineered for speed with Rust's zero-cost abstractions and an async, multi-threaded runtime
Seamless integration with Lua for high-performance scripting.
Fault-tolerant and extensible architecture that grows with your application
A single binary, packed with all the batteries included. Can also be used as a normal Lua runtime!
-- Create a new server
local server = Astra.http.server:new()
-- Register a route
server:get("/", function()
return "hello from default Astra instance!"
end)
-- You can also use the local variables within routes
local counter = 0
server:get("/count", function(request, response)
-- consume the request body
print(request:body():text())
-- set header code (Optional)
response:set_status_code(300)
-- set headers (Optional)
response:set_header("header-key", "header-value")
counter = counter + 1
-- and also can return JSON
return { counter = counter }
end)
-- Configure the server
server.port = 3000
-- Run the server
server:run()