YuZuoChen / wlua

wlua is a web framework for Lua that is as simple as it is powerful. Just a toy :)

Home Page:https://github.com/hanxi/wlua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wlua

license

中文 English

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()

Installation

Dependent library

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 pkgconfig

Build skynet need gcc 4.9+ .

Then install use this commond:

git clone https://github.com/hanxi/wlua
cd wlua
sudo make install

WLUA_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

Features

  • Routing use r3
  • Middleware support
  • Group router support
  • Easy to build HTTP APIs, web site, or single page applications

Quick Start

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 tips

Create app:

$ wlua new wlua_demo

Start server:

$ cd wlua_demo
$ wlua start

Visit http://localhost:8081 . Or use curl test:

curl -i http://localhost:8081

Other

About

wlua is a web framework for Lua that is as simple as it is powerful. Just a toy :)

https://github.com/hanxi/wlua

License:MIT License


Languages

Language:Lua 94.0%Language:Shell 4.6%Language:Makefile 1.4%