Created
February 21, 2017 21:53
-
-
Save cablehead/fd6944c666bc3f38a6a8f281c767761e 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
local levee = require("levee") | |
local fsource = require('levix.source.file') | |
local h = levee.Hub() | |
local err, sources = fsource.watch(h, "./sources.json") | |
print(err, sources) | |
local function serve(h) | |
local err, serve = h.http:listen(9999) | |
for conn in serve do | |
h:spawn(function() | |
while true do | |
local err, req = conn:recv() | |
if err then | |
conn:close() | |
return | |
end | |
print(req.path) | |
req.response:send({levee.HTTPStatus(200), {}, "Hello world\n"}) | |
end | |
end) | |
end | |
end | |
serve(h) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment