1. yum install make gcc readline-devel

    lua

    1. curl -R -O http://www.lua.org/ftp/lua-5.4.3.tar.gz
    2. tar zxf lua-5.4.3.tar.gz
    3. cd lua-5.4.3
    4. make all test
    5. make linux install
    6. ln -s /usr/local/bin/lua /usr/bin/lua

    luarocks

    1. wget https://luarocks.org/releases/luarocks-3.7.0.tar.gz
    2. tar zxpf luarocks-3.7.0.tar.gz
    3. cd luarocks-3.7.0
    4. ./configure && make && sudo make install
    5. sudo luarocks install luasocket

    on rpi

    1. sudo apt install lua-socket luarocks
    2. wget http://download.savannah.gnu.org/releases/lzip/lzlib/lzlib-1.12.tar.gz
    3. tar -xf lzlib-1.12.tar.gz
    4. cd lzlib-1.12
    5. ./configure && make all check
    6. make install
    7. make install-bin install-man
    8. luarocks install pegasus

    http://evandrolg.github.io/pegasus.lua/

    #!/usr/bin/lua
    local pegasus = require "pegasus"
    
    local server = pegasus:new({
      port='9090',
      location='example/root'
    })
    
    local printTable = function(table)
      for k, v in pairs(table) do
        print(k, '=', v)
      end
    end
    
    server:start(function (request, response)
      local method = request:method()
      local data = request:post()
      if data then
        printTable(data)
      end
      if method == "GET" then
        response:write("hi")
      end
      if method == "POST" then
        response:write("api")
      end
    end)