Skip to content

Pegasus.lua is a http server to work with web applications written in Lua language.

Notifications You must be signed in to change notification settings

comotion/pegasus.lua

 
 

Repository files navigation

Pegasus.lua

Pegasus.lua is a http server to work with web applications written in Lua language.

pegasus.lua

Installation

To install Pegasus.lua, run:

$ luarocks install pegasus

How does it work?

Follow an example:

local pegasus = require 'pegasus'

local server = pegasus:new('9090')

server:start(function (reqest, response)
  print "It's running..."
end)

API

Request

Properties

  • path A string with the request path
  • headers A table with all the headers data
  • method The output is the request method as a string ('GET', 'POST', etc)
  • querystring It returns a dictionary with all the GET parameters
  • post It returns a dictionary with all the POST parameters

Response

Methods

  • writeHead(number) It creates the head; the function receives a status code by parameter
  • finish(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)

Contributing

Install Dependencies

$ make install_dependencies

Running tests

$ make test

About

Pegasus.lua is a http server to work with web applications written in Lua language.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Lua 95.3%
  • HTML 3.4%
  • Makefile 1.3%