feat: add support for optional dynamic route params (#1706)
This commit is contained in:
@@ -28,14 +28,15 @@ File names are mapped to route patterns as follows:
|
||||
Here is a table of file names, which route patterns they map to, and which paths
|
||||
they might match:
|
||||
|
||||
| File name | Route pattern | Matching paths |
|
||||
| ------------------------- | ---------------------- | -------------------------- |
|
||||
| `index.ts` | `/` | `/` |
|
||||
| `about.ts` | `/about` | `/about` |
|
||||
| `blog/index.ts` | `/blog` | `/blog` |
|
||||
| `blog/[slug].ts` | `/blog/:slug` | `/blog/foo`, `/blog/bar` |
|
||||
| `blog/[slug]/comments.ts` | `/blog/:slug/comments` | `/blog/foo/comments` |
|
||||
| `old/[...path].ts` | `/old/:path*` | `/old/foo`, `/old/bar/baz` |
|
||||
| File name | Route pattern | Matching paths |
|
||||
| --------------------------- | ---------------------- | --------------------------------------- |
|
||||
| `index.ts` | `/` | `/` |
|
||||
| `about.ts` | `/about` | `/about` |
|
||||
| `blog/index.ts` | `/blog` | `/blog` |
|
||||
| `blog/[slug].ts` | `/blog/:slug` | `/blog/foo`, `/blog/bar` |
|
||||
| `blog/[slug]/comments.ts` | `/blog/:slug/comments` | `/blog/foo/comments` |
|
||||
| `old/[...path].ts` | `/old/:path*` | `/old/foo`, `/old/bar/baz` |
|
||||
| `docs/[[version]]/index.ts` | `/docs{/:version}?` | `/docs`, `/docs/latest`, `/docs/canary` |
|
||||
|
||||
Advanced use-cases can require that a more complex pattern be used for matching.
|
||||
A custom [URL pattern][urlpattern] can be specified in the route configuration.
|
||||
|
||||
Reference in New Issue
Block a user