instantcommerce / next-api-decorators

Collection of decorators to create typed Next.js API routes, with easy request validation and transformation.
https://next-api-decorators.vercel.app
MIT License
413 stars 29 forks source link

Failed to match deep nested route #482

Closed trungtin closed 1 year ago

trungtin commented 1 year ago

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

github-actions[bot] commented 1 year ago

: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:

ggurkal commented 1 year ago

Hi @trungtin

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

github-actions[bot] commented 1 year ago

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

The release is available on:

Your semantic-release bot :package::rocket: