瀏覽代碼

special customer 3-tier

3-tier-spec-customer
Ludovic 'Archivist' Lagouardette 3 年之前
父節點
當前提交
1907fc918c
共有 2 個文件被更改,包括 10 次插入4 次删除
  1. +1
    -1
      src/app/button.ecr
  2. +9
    -3
      src/app/view.cr

+ 1
- 1
src/app/button.ecr 查看文件

@ -3,7 +3,7 @@
<head></head>
<body>
<div> <%= count %> </div>
<form action="/">
<form method="POST" action=&lt;%= &#34;/";+name %>;>
<input type="submit" value="Go">
</form>
</body>

+ 9
- 3
src/app/view.cr 查看文件

@ -1,12 +1,18 @@
require "kemal"
require "./business.cr"
get "/" do
get "/:name" do |env|
name = env.params.url["name"]
count = Business.fetch_add(0);
render "./src/app/button.ecr";
end
post "/" do
count = Business.fetch_add(1);
post "/:name" do |env|
adder = 1;
name = env.params.url["name"]
if name == "archivist"
adder = 10;
end
count = Business.fetch_add(adder);
render "./src/app/button.ecr";
end

Loading…
取消
儲存