Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

add host-based routing docs #1313

Merged
merged 9 commits into from Oct 25, 2021
Merged

Conversation

WhiteApfel
Copy link
Contributor

Yesterday I wanted to use host-based routing, saw the necessary methods in the Starlette class, but did not find any info in docs. After searching, I found #363 and decided to add at least a minimal mention of host-based routing to the documentation.

#369 opened almost three years ago and is still open 馃ぁ

docs/routing.md Outdated Show resolved Hide resolved
Copy link
Member

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...
routes = [
     Host('api.example.org', api)
 ]
 app = Starlette(routes=routes)
 app.host('www.example.org', site)
 news_host = Host('news.example.org', news)
 app.router.routes.append(news_host)

I think this is much better. Do you think we may need a little explanation here?

@WhiteApfel
Copy link
Contributor Author

There are several ways to connect host-based routes to your application

It'll do? I think that this does not make much sense, because the meaning from the upper sections is duplicated

@aminalaee
Copy link
Member

That makes sense.

@aminalaee aminalaee changed the title 馃摑 Docs: add host-based routing example add host-based routing docs Oct 25, 2021
Copy link
Member

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this.

@aminalaee aminalaee merged commit d87c93e into encode:master Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants