text: use UInt32 to manipulate chars
[nit.git] / src / web / web.nit
index c6a12f0..36d7e98 100644 (file)
 # Components required to build a web server about the nit model.
 module web
 
-import web_actions
-import model_api
+import api_auth
+import api_model
+import api_catalog
+import api_graph
+import api_docdown
+import api_metrics
+import api_feedback
+
+redef class APIRouter
+       redef init do
+               super
+               use("/*", new APIErrorHandler(config)) # catch 404 errors
+       end
+end
+
+# Error handler user to catch non resolved request by the API
+#
+# Displays a JSON formatted 404 error.
+class APIErrorHandler
+       super APIHandler
+
+       redef fun all(req, res) do
+               res.api_error(404, "Not found")
+       end
+end