Pegasus.lua is a http server to work with web applications written in Lua language.
To install Pegasus.lua, run:
$ luarocks install pegasus
Follow an example:
local pegasus = require 'pegasus'
local server = pegasus:new('9090')
server:start(function (reqest, response)
print "It's running..."
end)
path
A string with the request pathheaders
A table with all the headers datamethod
The output is the request method as a string ('GET', 'POST', etc)querystring
It returns a dictionary with all the GET parameterspost
It returns a dictionary with all the POST parameters
writeHead(number)
It creates the head; the function receives a status code by parameterfinish(string)
It creates the body; it accepts a content as parameter
local pegasus = require 'pegasus'
local server = pegasus:new('9090')
server:start(function (req, rep)
rep.writeHead(200).finish('hello pegasus world!')
end)
$ make install_dependencies
$ make test