Created
March 1, 2016 11:57
-
-
Save daurnimator/7871678fe6f00aaa7d4d to your computer and use it in GitHub Desktop.
Prototyping lua-http server api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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