Routing for Hosts and Subdomains#363
Merged
lovelydinosaur merged 2 commits intomasterfrom Jan 30, 2019
Merged
Conversation
Closed
Contributor
Author
|
Let's get this in. We can expand the documentation in due course. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
app.host(host, app), which mirrors the existingapp.mount(path, app).Host(...)routing class, which mirrors the existingMountrouting class.Closes #360
Examples:
Website and API, with separate routing rules:
A custom subdomain:
Features:
request.url_for("users_list", subdomain=...)app.host('api.example.org', api, name="api')will then require reverse lookups like eg.request.url_for("api:users_list")request.path_params.Considerations:
request.path_paramsisn't exactly correct anymore. Should we move torequest.route_paramsor something?hostsfile?We might like subdomain parameters to be optional. If they're not included thenActually probably forget about that - we don't expect it with submounted paths, we shouldn't expect it here.request.url_forshould default to current domain. (Assuming it matches the pattern?)