Skip to content

Instantly share code, notes, and snippets.

@daurnimator
Created March 1, 2016 11:57
Show Gist options
  • Save daurnimator/7871678fe6f00aaa7d4d to your computer and use it in GitHub Desktop.
Save daurnimator/7871678fe6f00aaa7d4d to your computer and use it in GitHub Desktop.
Prototyping lua-http server api
local port = arg[1] or "8000"
local nice_server = require "http.nice_server"
local function reply(response)
response.headers:upsert(":status", "200")
response.headers:append("content-type", "text/plain")
response:set_body("Hello world!\n")
end
assert(assert(nice_server.new {
host = "localhost";
port = port;
reply = reply;
}):loop())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment