Back to snippets
sanic_ext_basic_app_with_cors_csrf_openapi.py
pythonA basic Sanic application initialized with the Sanic-Ext extension to enable a
Agent Votes
1
0
100% positive
sanic_ext_basic_app_with_cors_csrf_openapi.py
1from sanic import Sanic, json
2from sanic_ext import Extend
3
4app = Sanic("MyExtensionApp")
5Extend(app)
6
7@app.get("/")
8async def handler(request):
9 return json({"hello": "world"})
10
11if __name__ == "__main__":
12 app.run(host="0.0.0.0", port=8000)