diff --git a/lantern/main.py b/lantern/main.py index c17dff8..d64e9e6 100644 --- a/lantern/main.py +++ b/lantern/main.py @@ -1,18 +1,11 @@ from sanic import Sanic -from sanic.response import json, text -from sanic.exceptions import NotFound +from lantern.route import main_route + app = Sanic() -@app.route("/") -async def test(request): - return json({"hello": "world"}) - - -@app.exception(NotFound) -def ignore_404s(request, exception): - return text("Page not found at {}".format(request.url), status=404) - def main(): + app.add_route(main_route, "/") + app.add_route(main_route, "/") app.run(host="0.0.0.0", port="8000") diff --git a/lantern/route.py b/lantern/route.py new file mode 100644 index 0000000..ceed5c1 --- /dev/null +++ b/lantern/route.py @@ -0,0 +1,5 @@ +from sanic.response import json + + +async def main_route(request, path=None): + return json({"hello": "world"})