wlua is a web framework for Lua that is as simple as it is powerful.
local wlua = require "wlua"
local app = wlua:default()
app:get("/", function (c)
c:send("Hello wlua!")
end)
app:run()Build libr3 need this library:
# Ubuntu
sudo apt-get install check libpcre3 libpcre3-dev build-essential libtool \
automake autoconf pkg-config
# CentOS 7
sodu yum install gcc gcc-c++ git make automake autoconf pcre pcre-devel \
libtool pkgconfigBuild skynet need gcc 4.9+ .
Then install use this commond:
git clone https://github.com/hanxi/wlua
cd wlua
sudo make installWLUA_HOME and WLUA_BIN are supported by Makefile, so the following command could be used to customize installation, default WLUA_HOME is /usr/local/wlua and WLUA_BIN is /usr/local/bin/wlua :
make install WLUA_HOME=/usr/local/wlua WLUA_BIN=/usr/local/bin/wlua- Routing use r3
- Middleware support
- Group router support
- Easy to build HTTP APIs, web site, or single page applications
A quick way to get started with wlua is to utilize the executable cli tool wlua to generate an scaffold application.
wlua commond is installed with wlua framework. it looks like:
$ wlua help
wlua 0.01, a web framework for Lua that is as simple as it is powerful.
Usage: wlua COMMAND [OPTIONS]
Commands:
new <name> Create a new application
start Start the server
stop Stop the server
reload Reload the server
version Show version of wlua
help Show help tipsCreate app:
$ wlua new wlua_demoStart server:
$ cd wlua_demo
$ wlua start
Visit http://localhost:8081 . Or use curl test:
curl -i http://localhost:8081- More test in demo: https://github.com/hanxi/wlua-demo
- More page in blog: http://blog.hanxi.cc/p/74/
- A tools for monitor skyent cluster https://github.com/hanxi/skynet-admin