A minimalistic web framework for Lua. High-quality port of express.js
local express = require("express")
local app = express()
app:get("/", function(_, res)
res:send("Hello World!")
end)
app:listen(3000)
luarocks install lua-express
# or
docker pull ghcr.io/trigonim/lua-express:main
- ✅ Same features as in the original express (except of rendering engine. temporarily) ➕
- 🪞 API implementation and similarity with express.js is almost 100%. Even in small details 🔥
- 🧩 Easy to embed into any existing lua applications of any complexity
- 🪶 Lowest possible amount of third-party dependencies
- 🚀 Asynchronous (non-blocking) processing of incoming requests
- 🛠️ Easy to extend and modify with third-party modules
- 🏋️♂️ Several highly loaded web applications are already running on lua-express right now
- 🍪 Working with cookies. Accessing a site with a secret cookie
- 🧠 Advanced example. Working with routers, using middlewares, handling errors, displaying request information
- 🔗 Client disconnection handler. Simplest non-blocking implementation of client disconnection event
- Middlewares collection. Ready to use
- Long Polling Server. One more app written in lua-express
- pegasus – minimalistic web server
- luasocket – shipped with pegasus
- copas (optional in the feature) – non-blocking processing of incoming requests. Also useful to make mysql/redis/http-client libs asynchronous
- cjson (optional. Only if the
res:json(obj)
function is required)
flowchart LR
Fork((Fork the project))
Fork-->Edit[Edit files]
Edit-->commit[Commit the changes]
commit-->|Finally|creatpr((Create a Pull Request))
luarocks install copas
luarocks install pegasus
# not sure if this is really needed :)
luarocks install luasec
# only for res:json(obj)
# luarocks install lua-cjson
git clone https://github.com/TRIGONIM/lua-express && cd lua-express
# add local module path to LUA_PATH env
export LUA_PATH="$(pwd)/lua/?.lua;$(pwd)/lua/?/init.lua;$LUA_PATH"
# do what you want.
lua examples/cookie.lua
# commit and pull request