|
@ -3,16 +3,30 @@ require "./business.cr" |
|
|
|
|
|
|
|
|
get "/:name" do |env| |
|
|
get "/:name" do |env| |
|
|
name = env.params.url["name"] |
|
|
name = env.params.url["name"] |
|
|
count = Business.fetch_add(0); |
|
|
|
|
|
render "./src/app/button.ecr"; |
|
|
|
|
|
|
|
|
stack = Lua.load; |
|
|
|
|
|
stack.set_global("Business", Business.new); |
|
|
|
|
|
stack.run File.new("./scripts/my_func.lua"); |
|
|
|
|
|
display_event = stack.run %q{ |
|
|
|
|
|
return display_event; |
|
|
|
|
|
}; |
|
|
|
|
|
view = render "./src/app/button.ecr"; |
|
|
|
|
|
stack.close; |
|
|
|
|
|
view; |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
post "/:name" do |env| |
|
|
post "/:name" do |env| |
|
|
adder = 1; |
|
|
|
|
|
name = env.params.url["name"] |
|
|
name = env.params.url["name"] |
|
|
if name == "archivist" |
|
|
|
|
|
adder = 10; |
|
|
|
|
|
end |
|
|
|
|
|
count = Business.fetch_add(adder); |
|
|
|
|
|
render "./src/app/button.ecr"; |
|
|
|
|
|
|
|
|
stack = Lua.load; |
|
|
|
|
|
stack.set_global("Business", Business.new); |
|
|
|
|
|
stack.run File.new("./scripts/my_func.lua"); |
|
|
|
|
|
run_event = stack.run %q{ |
|
|
|
|
|
return run_event; |
|
|
|
|
|
}; |
|
|
|
|
|
display_event = stack.run %q{ |
|
|
|
|
|
return display_event; |
|
|
|
|
|
}; |
|
|
|
|
|
run_event.as(Lua::Function).call(name); |
|
|
|
|
|
view = render "./src/app/button.ecr"; |
|
|
|
|
|
stack.close; |
|
|
|
|
|
view; |
|
|
end |
|
|
end |