Created
June 30, 2013 00:01
-
-
Save enotodden/5893202 to your computer and use it in GitHub Desktop.
Turbo request parameters example.
This file contains 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 turbo = require("turbo") | |
local HelloNameHandler = class("HelloNameHandler", turbo.web.RequestHandler) | |
function HelloNameHandler:get() | |
-- Get the 'name' argument, or use 'Santa Claus' if it does not exist | |
local name = self:get_argument("name", "Santa Claus") | |
self:write("Hello " .. name .. "!") | |
end | |
function HelloNameHandler:post() | |
-- Get the 'name' argument, or use 'Easter Bunny' if it does not exist | |
local name = self:get_argument("name", "Easter Bunny") | |
self:write("Hello " .. name .. "!") | |
end | |
local application = turbo.web.Application:new({ | |
{"/hello", HelloNameHandler} | |
}) | |
application:listen(8888) | |
turbo.ioloop.instance():start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment