Public | Automated Build

Last pushed: 11 days ago
Short Description
lucid builds
Full Description

Lua Web API Toolkit


A web API toolkit playground for the Lua programming language.

Installation

luarocks install --server=http://luarocks.org/dev lucid

... or use docker images.

Overview

Using a function:

local http = require 'http'

local app = http.app.new()
app:use(http.middleware.routing)

app:get('', function(w, req)
    return w:write('Hello World!\n')
end)

return app()

... or a metaclass:

local class = require 'core.class'
local web = require 'web'

local WelcomeHandler = class({
    get = function(self)
        self.w:write('Hello World!\n')
    end
})

local options = {
    urls = {
        {'', WelcomeHandler}
    }
}

return web.app({web.middleware.routing}, options)

see more here.

Setup

Install development dependencies:

sudo make debian
make env nginx
make test qa
eval "$(env/bin/luarocks path --bin)"

alternative environments:

make env LUA_VERSION=5.2.4
make env LUA_IMPL=luajit LUA_VERSION=2.0.4
make env LUA_IMPL=luajit LUA_VERSION=2.1.0-beta2

Run

Check from the command line:

lurl -v demos/http/hello.lua /

Serve files with a web server:

export app=demos.http.hello ; make run
curl -v http://localhost:8080

Open your browser at http://localhost:8080

Docker Pull Command
Owner
akorn
Source Repository