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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
⌂ 换网址