subdomain #1684
Answered
by
JacobCoffee
MamadouSDiallo
asked this question in
Q&A
subdomain
#1684
-
Hi all I would like to know if litestar support subdomain e.g. Below I used chatGPT to general an minimumal example with starlette. from starlette.applications import Starlette
from starlette.routing import Route, Mount
async def index(request):
return PlainTextResponse('Welcome to the main domain!')
async def subdomain(request):
return PlainTextResponse('Welcome to the subdomain!')
routes = [
Route('/', endpoint=index),
Route('/', endpoint=subdomain, methods=["GET"], host="subdomain.example.com"),
]
app = Starlette(routes=routes)
if __name__ == '__main__':
import uvicorn
uvicorn.run(app, host='0.0.0.0', port=8000) |
Beta Was this translation helpful? Give feedback.
Answered by
JacobCoffee
Aug 11, 2023
Replies: 1 comment
-
Hi, we do not support host-based routing. https://docs.litestar.dev/2/migration/fastapi.html#host-based-routing
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Alc-Alc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, we do not support host-based routing.
https://docs.litestar.dev/2/migration/fastapi.html#host-based-routing