allow using a list of hosts on a route

This commit is contained in:
Raphael Deem
2017-01-18 19:40:20 -08:00
parent e218a59911
commit 2c1ff5bf5d
3 changed files with 32 additions and 2 deletions

View File

@@ -11,9 +11,16 @@ from sanic.blueprints import Blueprint
app = Sanic()
bp = Blueprint("bp", host="bp.example.com")
@app.route('/', host=["example.com",
"somethingelse.com",
"therestofyourdomains.com"])
async def hello(request):
return text("Some defaults")
@app.route('/', host="example.com")
async def hello(request):
return text("Answer")
@app.route('/', host="sub.example.com")
async def hello(request):
return text("42")