Commit 89368d22 authored by Jake Howard's avatar Jake Howard
Browse files

Modulize

parent d73a6b77
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)
app = Sanic()
def main():
app.add_route(main_route, "/<path>")
app.add_route(main_route, "/")
app.run(host="0.0.0.0", port="8000")
from sanic.response import json
async def main_route(request, path=None):
return json({"hello": "world"})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment