-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Route matching with params #59
Comments
Similar question, what if I place a directory under e.g. |
@nodegin yes, it maps that way @nickdandakis It's not possible right now. It doesn't mean it won't be possible in the future. |
Since zeit.co is built with next.js, do all their blog urls just map to static files???
Anyhow, I do believe the majority of non-trivial sites depend on some form of dynamic routing (route params). So this should be pretty high up there in the future todo list, right? |
I'm so happy to (and want to) move a lot of apps to next once we've dynamic routing. |
See also #25. It's the issue about custom server support which you can implement any routings. |
I'm proposing a change where parameterized routes can be defined in {
"next": {
"routes": {
"/posts/:id": "posts/post",
"/posts/:id/comments": "posts/post/comments"
}
}
} This implementation shouldn't interfere with existing routing logic. Parameters are also passed through the component props via Implementation: |
Related: #91 |
@dstreet Personally, I think |
@nmuth, I completely agree. Not sure why I didn't think of that at first. |
I have parametric routing working using the fantastic https://github.com/hapijs/call. It allows me to define all sorts of parametric routes. For example a |
@sebasgarcep do you have an example or docs on how to use this? |
Hey all, now we've support for custom routes. |
@arunoda I have some issues with the way custom routes work. Mainly that Next does not exposes its render methods and you have to pass it the raw request and response objects. Of course, that doesn't always plays nice with frameworks like Hapi when you want to embed Next. @parkerproject If you're still interested you can email me. |
Requiring the raw request and response objects sounds like a good abstraction. Maybe Hapi should expose them, rather than us not require them? |
They do expose them 😄, though it is not recommended to interact directly with them. Anyways, thanks for the input. It's a great project you have here. |
@sebasgarcep also, we do plan on exposing low-level APIs (they have been picked and designed with that in mind), but when we played around with them, they ended up being really not ergonomic. Furthermore, we found that |
I've prepared with-extracted-stylesheet example with custom routes that fallback to appropriate pages in both development and production, even for dynamic urls like described here: #3451 |
how about this one. project 1 (SSR using next js) project 2 (the same), but project 1 front end call the project 2 server, how do i get the params in server of project 2 that url is rendered in project 1 on front end side? |
if I want to export the routes to static files your solution ( |
@fortil, I think it does not work with static routes and that it requires a server. A static server wouldn't be able to replace an ID in the URL with static-served content (if it could then it wouldn't be a static server anymore). What I mean is, if we have a URL |
* Add Travis CI example * Fixes changes requested in pull request 59
Is there any support for route params like so?
/photos/:id
If not, how would that look with the proposed
pages/*.js
structure?The text was updated successfully, but these errors were encountered: