next-api-decorators icon indicating copy to clipboard operation
next-api-decorators copied to clipboard

Failed to match deep nested route

Open trungtin opened this issue 2 years ago • 2 comments

for example if the api route file is at '/pages/api/deep/nested/route/[[...params]].ts' then I expect the @Get() URL pattern should match from /deep/nested/route/ but instead it only match from /deep/

class RouteHandler {
  @Get()
  public get() {
    console.log('should resolve to this');
    return true;
  }

  @Get('/nested/route')
  public getDeep() {
    console.log('should not resolve to this');
    return false;
  }
}

The first handle should run instead of the second.

here is the reproduction to play with https://stackblitz.com/edit/nextjs-n4xefv

trungtin avatar Sep 27 '22 11:09 trungtin

:tada: This issue has been resolved in version 2.0.1-beta.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Oct 16 '22 09:10 github-actions[bot]

Hi @trungtin

Thanks for the bug report! Just released a fix on beta channel. Let me know the outcome.

ggurkal avatar Oct 16 '22 09:10 ggurkal

:tada: This issue has been resolved in version 2.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Jan 14 '23 11:01 github-actions[bot]