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
# This is a comment, only seperate-line comments are supported | |
mything /long/path/to/my/thing | |
foo /Users/myuser/bar | |
# When a path doesn't start with / it is mapped relative to $HOME: | |
myotherthing Downloads/foo/bar |
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
# Create a new environment with turbo-virtual-env, with the 'penlight' package from luarocks. | |
$ cd /tmp | |
$ mkdir myproject | |
$ cd myproject | |
$ #Tell turbo-virtual-env to pass 'penlight' to luarocks for installation | |
$ echo "penlight" >> ./requirements.txt | |
$ turbo-virtual-env --create ./env -r ./requirements.txt |
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" | |
application = turbo.web.Application:new({ | |
{"/static/(.*)$", turbo.web.StaticFileHandler, "/var/www/"}, | |
}) | |
application:listen(8888) | |
turbo.ioloop.instance():start() |
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 IndexHandler = class("IndexHandler", turbo.web.RequestHandler) | |
function IndexHandler:get() | |
self:write("Index..") | |
end | |
local UserHandler = class("UserHandler", turbo.web.RequestHandler) | |
function UserHandler:get(username) | |
self:write("Username is " .. username) |
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 HelloJSONHandler = class("HelloJSONHandler", turbo.web.RequestHandler) | |
function HelloJSONHandler:get() | |
self:write({hello="json"}) | |
end | |
local application = turbo.web.Application:new({ | |
{"/hello", HelloJSONHandler} | |
}) |
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 |
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") | |
-- 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({ |
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
#!/usr/bin/env python | |
import os | |
import sys | |
import re | |
import argparse | |
if sys.version_info.major == 3: | |
from io import StringIO | |
else: | |
from StringIO import StringIO |