local orbit = require'orbit' local site = setmetatable( orbit.new(), { __index = _G } ) setfenv( 1, site ) function layout( web, args, inner_html ) return html { head { title( "Test Orbit App" ) }, body { div { id = "wrapper", style = "width: 90%; border: 1px solid black;", div { id = "titlebar", h1( "Test Orbit App" ), style = "text-align: center;" }, div { id = "content", inner_html } } } } end function render_index( web, args ) return layout( web, args, form { style = "text-align: center;", action = web:link("/input"), method = "post", input { type = "text", name = "test" }, input { type = "submit", value = "Submit" } }) end function index( web, args ) return render_index( web, args ) end site:dispatch_get( index, "/" ) function render_input( web, args ) return layout( web, args, div { id = "input_data", p( table.concat( web.input, "\n" ) ) }) end -- not 'input' for ambiguity reasons function getinput( web, args ) return render_input( web, args ) end site:dispatch_post( getinput, "/input" ) site:htmlify( layout, "render_.+" ) return site