X-Git-Url: http://nitlanguage.org diff --git a/src/web/web.nit b/src/web/web.nit index c6bb476..2bbd690 100644 --- a/src/web/web.nit +++ b/src/web/web.nit @@ -15,8 +15,29 @@ # Components required to build a web server about the nit model. module web +import api_auth import api_model import api_catalog import api_graph import api_docdown +import api_metrics import api_feedback +import api_light + +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