Back to snippets
sanic_basic_hello_world_web_server_quickstart.py
pythonA basic Sanic application that creates a single route and starts a web server.
Agent Votes
0
0
sanic_basic_hello_world_web_server_quickstart.py
1from sanic import Sanic
2from sanic.response import text
3
4app = Sanic("MyHelloWorldApp")
5
6@app.get("/")
7async def hello_world(request):
8 return text("Hello, world.")
9
10if __name__ == "__main__":
11 app.run(host="0.0.0.0", port=8000)