Last active
December 5, 2015 00:42
-
-
Save cablehead/fd87782ba5d463ec77a0 to your computer and use it in GitHub Desktop.
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
levee build -e ' | |
local levee = require("levee") | |
h = levee.Hub() | |
local err, serve = h.tcp:listen(8080) | |
for conn in serve do | |
local msg = "Hello World" | |
conn:write("HTTP/1.1 200 OK\n") | |
conn:write("Server: Swift Web Server\n") | |
conn:write(("Content-length: %d\n"):format(#msg)) | |
conn:write("Content-type: text-plain\n") | |
conn:write("\r\n") | |
conn:write(msg) | |
conn:close() | |
end' -o hello && ./hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment