from sanic import Sanic
from sanic.response import json
app = Sanic("My Hello, world app")
@app.route("/")
async def test(request):
return json({"hello": "world"})
if __name__ == "__main__":
app.run()
❯ curl localhost:8000 -i
HTTP/1.1 200 OK
content-length: 17
connection: keep-alive
content-type: application/json
{"hello":"world"}