Skip to content

mongjong59/next-param-routing-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

next-param-routing-example

Matching path parameters to corresponding pages isn't supported out-of-box by Next.js.

In this example, a custom Express server is configured so that any positive integer segment in the URL path will transformed to "$param" to match the corresponding page and the original value will be stored as query string instead.

For instance, /posts/6/comments/62 will be matched to src/pages/$param/comments/$param.js in the filesystem and the IDs 6 and 62 will be provided in the query object.

Run the Application

yarn install
yarn dev

And then visit http://localhost:3000/

About

A Next.js example that supports parameters in routing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published