popcorn :: CounterAPI :: defaultinit
class CounterAPI
super Handler
var counter = 0
fun json_counter: JsonObject do
var json = new JsonObject
json["label"] = "Visitors"
json["value"] = counter
return json
end
redef fun get(req, res) do
res.json(json_counter)
end
redef fun post(req, res) do
counter += 1
res.json(json_counter)
end
end
lib/popcorn/examples/angular/example_angular.nit:23,1--43,3