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 formatscore :: union_find
union–find algorithm using an efficient disjoint-set data structure
import popcorn
class SimpleErrorHandler
super Handler
redef fun all(req, res) do
if res.status_code != 200 then
res.send("An error occurred!", res.status_code)
end
end
end
class SomeHandler
super Handler
redef fun get(req, res) do res.send "Hello World!"
end
var app = new App
app.use("/", new SomeHandler)
app.use("/*", new SimpleErrorHandler)
app.listen("localhost", 3000)
lib/popcorn/examples/middlewares/example_simple_error_handler.nit:17,1--39,29