Nest routing issue with nested pages
See original GitHub issueDescribe the bug It’s common to have page structures such as the following
- pages
- index.tsx
- users
- index.tsx
- [id].tsx
I have a simple UsersController
that takes care of rendering all pages in pages/users
. However, the following doesn’t work:
@Controller('users')
export class UsersRenderController {
constructor(private usersService: UsersService) { }
@Get('/')
@Render('users/index')
async showAll() {
return {};
}
The result is a 404.
Strangely, when renaming the file pages/users/index.tsx
to e.g. pages/users/users.tsx
and changing the @Render
line appropriate, that does work! However, it would mess up rendering for Next.js.
This seems quite an obvious one, so what am I missing here? None of the examples contain nested pages, so it’s been hard to sanity-check.
Expected behavior
It should be possible to render nested pages as in the example above, e.g. pages/users/index.tsx
.
To Reproduce I can share the repo with someone privately, but it should be very simple to copy the above example in an existing repo.
Version
- next.js: 12.3.1
- nest: 9.0.0
- nest-next: 10.0.0
Issue Analytics
- State:
- Created a year ago
- Comments:15 (8 by maintainers)
Top GitHub Comments
PR is updated. Also thrown in Vercel Next.js license just in case.
Logs definitely are not on purpose and are debugging leftovers - will remove them. Also thinking about renaming
next
directory tovendor/next
. Probably will update the PR now