-
Notifications
You must be signed in to change notification settings - Fork 27k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
catch-all routing with an _all.js #223
Conversation
Some conversation about this PR from Slack https://zeit-community.slack.com/archives/next/p1478557230000387 TLDR;
so if that's the world we live in, and we have server-side |
This is an interesting approach. I need to think about it more. |
As a note, It could also make sense to default the "catch-all" file to |
Also, considering we already support |
As in, to extract the "fancy parameter", you'd just have to |
My only concern is how we handle this client-side with
|
@rauchg You just saved 2 lines of code with |
regarding That's why I prefer to call this a "catch all" instead of any fancier type of regexp-style routing, because it would be misleading |
Indeed. So I have to think about whether this behavior is worth it. Otherwise, every single folder will stop handling |
But we also need to think about how to handle |
But ultimately I guess that's not related to this PR. Since we would still want that for |
Yeah, I agree that fancier error handling is a good idea, but should be a more global update (and not located to just this PR) You've already got support for creating a 500, and it is pretty easy :D render () {
if(this.state.user_id > 5){
throw 500
}
return <div>
<p>user_id: {this.state.user_id}</p>
<Link href={'/'}>Back</Link>
</div>
} Perhaps we can throw |
instead of // equivalent to /users/:id/posts/:title
.
└── pages
├── index.js
└── users
├── _id
│ ├── edit.js
│ ├── index.js
│ └── posts
│ ├── _title
│ │ ├── edit.js
│ │ └── index.js
│ ├── index.js
│ └── new.js
├── index.js
└── new.js Here's how you could mimic a wordpress blog's permalink structure (with paginated archives on year and month):
This would cover all use cases i can think of, the only thing this doesn't allow for (out-of-the-box at least) is a medium-like permalink structure: |
@jaredpalmer Doesn't the solution run into issues if there's more than one folder? If I have both Seems like you'd want something like |
I remain unconvinced of these smart handlers. We are just going to make the On Mon, Nov 21, 2016 at 6:29 AM narfanator notifications@github.com wrote:
|
@rauchg so what is the path forward here? I can add an |
I'm documenting the path forward with this in an issue which I should have ready within a day or two |
Part of the solve for #25
re: #25 (comment)
From the README update: