lua-server

command module
v0.0.0-...-f37bdba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

lua-server

Build

Small experiment of mine over the holiday to make a webserver with lua. This is by no means meant to be a production system so please don't use it as such.

app/routes.lua file starts a server like this:

local m = require("modules")

routes = {
    index = "/",
    user = "/user"
}

m.startServer('8080')

Then for the /user route create a file app/user.lua and that file will be executed when that endpoint is hit:

local m = require("services")

local b = "<h1>Hello There</h1>" ..
        "<p>here's a paragraph</p>" ..
        "<button>Button</button>"

response.body = b

The response.body can be set to any string and this will be sent to the browser as html.

If data is sent to form using POST or PUT methods, the data is placed in a global table called POST_DATA.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL