Explorar el Código

special customer 3-tier

3-tier-spec-customer
Ludovic 'Archivist' Lagouardette hace 3 años
padre
commit
1907fc918c
Se han modificado 2 ficheros con 10 adiciones y 4 borrados
  1. +1
    -1
      src/app/button.ecr
  2. +9
    -3
      src/app/view.cr

+ 1
- 1
src/app/button.ecr Ver fichero

@ -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 Ver fichero

@ -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

Cargando…
Cancelar
Guardar