Skip to content

Instantly share code, notes, and snippets.

@ayourtch
Created March 29, 2010 01:06
Show Gist options
  • Save ayourtch/347210 to your computer and use it in GitHub Desktop.
Save ayourtch/347210 to your computer and use it in GitHub Desktop.
function default_page(page, req, resp, params)
local form = {
{ "text", name = "textfield", id = "stTagInput", autocomplete = "off", class = "input-text",
value = params.test, title = "this is a text" },
{ "submit", value = "set", class = "input-btn" },
method = "post", action = "post", id = "UpdateForm"
}
page.myform = form
include("test.html", page, req, resp, params)
end
-- more functions here
routing {
print = print, read = read,
get { "/login/(.+)/(.+)", login, params = {
test = { optional, numeric },
something = { optional },
path_capture_1 = { mandatory, lisp_like_id },
path_capture_2 = { mandatory, numeric },
},
on_error = paint_form,
},
post { "/k", postfunc },
get { "/status", status_func },
post { "/post", postfunc, params = {
textfield = { mandatory },
},
on_error = paint_form,
},
get { "/", default_page, params = {
test = { optional },
}
},
get { "/skin/(.+)", skin_page, params = {
test = { optional },
path_capture_1 = { mandatory },
},
on_error = paint_form,
},
post { "/", default_page },
get { ".*", redirect_request_to("/") },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment