FileServer
action, which is a standard and minimal file server
HttpRequest
class and services to create it
Serializable::inspect
to show more useful information
more_collections :: more_collections
Highly specific, but useful, collections-related classes.serialization :: serialization_core
Abstract services to serialize Nit objects to different formatsdeserialize_json
and JsonDeserializer
serialize_to_json
and JsonSerializer
core :: union_find
union–find algorithm using an efficient disjoint-set data structure
# This is an example of how to use angular.js with popcorn
module example_angular is example
import popcorn
import popcorn::pop_json
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
var app = new App
app.use("/counter", new CounterAPI)
app.use("/*", new StaticHandler("www/", "index.html"))
app.listen("localhost", 3000)
lib/popcorn/examples/angular/example_angular.nit:17,1--48,29