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