Skip to content
Simple Lua web framework
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
src
vendor
.gitignore
.gitmodules
LICENSE
Makefile
README.md
lua-web-0.6-1.rockspec

README.md

About

lua-web was a simple web framework base on m_net, hyperparser, m_dnscnt.

NOT support HTTPS now.

using likes luvit.

Compile

requires luarocks to build c modules.

$ git clone https://www.github.com/lalawue/lua-web.git
$ cd lua-web
$ git submodule update --init --recursive
$ make

Examples

1. helloworld

this example shows how to get HTTP method, URL path and query word, http header key/value, run as

$ lua examples/helloworld.lua '127.0.0.1:8080'

open your browser and visit 'http://127.0.0.1:8080/basic/search?q=howto' to get 'Hello, world!'.

2. file download page

please provide a file for download as

$ lua examples/file-transfer.lua '127.0.0.1:8080' [FILE_FOR_DOWNLOAD]

open your browser and visit 'http://127.0.0.1:8080', then click download link, the [FILE_FOR_DOWNLOAD] will rename as 'data.bin' with Content-type "application/octet-stream".

support large file.

3. file upload page

please provide a dir for upload as

$ lua examples/file-uploader.lua '127.0.0.1:8080' [DIR_FOR_UPLOAD]

open your browser and visit 'http://127.0.0.1:8080', select a file, then click submit to upload, the 'upload_data.bin' in [DIR_FOR_UPLOAD] is the file uploaded.

the program parse 'multipart/form-data' in HTTP body, not very precise.

4. HTTP request

raise HTTP request to server as

$ lua examples/request.lua 'http://www.google.com'
You can’t perform that action at this time.