I currently have a file structure like so within the 'src' directory:
|____pages
| |____FirstPage
| | |____First.js
| | |____index.js
| |____SecondPage
| | |____Second.js
| | |____index.js
| |____FirstDynamicRoutePage
| | |____PageToRenderOnDynamicRoute.js
| | |____index.js
I would like to keep this file structure and use dynamic routing. For example, the route for 'PageToRenderOnDynamicRoute.js" will be something like '/page/pageType/:pageId/otherSlug/:slug'.
I am aware that I can use the dynamic routing provided by Next.js, but I do not want to use the necessary file structure of:
| |____page
| | |____pageType
| | | |____[pageId]
| | | | |____otherSlug
| | | | | |____[slug].js
I have tried using next-routes, but ran into many issues, including: returned 404 when using getStaticProps or getServerSideProps, returned 404 on refresh of page, returned 404 when url typed in manually.
Does anyone know of a way that I can keep my existing file structure AND use dynamic routing? I am open to any options, including continuing to try next-routes if you are aware of working solutions to the aforementioned issues. I appreciate your help!