Skip to content

Commit

Permalink
Added HTTP server file example
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Ritzl committed Mar 13, 2017
1 parent 6fd7b3f commit 644a321
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/basic/example.gui_script
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ function init(self)
self.http_server.router.get("/$", function()
return self.http_server.html("Hello World")
end)
self.http_server.router.get("^/logo$", function()
local f = io.open("assets/images/logo.png")
local data = f:read("*a")
return self.http_server.file(data, "logo.png")
end)
self.http_server.router.unhandled(function(method, uri)
return self.http_server.html("Oops, couldn't find that one!", http_server.NOT_FOUND)
end)
Expand Down

0 comments on commit 644a321

Please sign in to comment.