Skip to content

Instantly share code, notes, and snippets.

@enotodden
Created June 28, 2013 22:36
Show Gist options
  • Save enotodden/5888700 to your computer and use it in GitHub Desktop.
Save enotodden/5888700 to your computer and use it in GitHub Desktop.
Turbo 'Hello World'.
local turbo = require("turbo")
-- Create a new requesthandler with a method get() for HTTP GET.
local HelloWorldHandler = class("HelloWorldHandler", turbo.web.RequestHandler)
function HelloWorldHandler:get()
self:write("Hello World!")
end
-- Create an Application object and bind our HelloWorldHandler to the route '/hello'.
local application = turbo.web.Application:new({
{"/hello", HelloWorldHandler}
})
-- Set the server to listen on port 8888 and start the ioloop.
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