typestack/routing-controllers

fix: Breaking Change in 0.10.0, @koa/router and trailing slash

Aareksio opened this issue · 2 comments

Description

routing-controllers registers all routes with trailing slashes (eg. /user/). Updated router do not automagically removes the trailing slash. Meaning accessing routes without trailing slash returns 404.

Related issue: koajs/router#79

Expected behavior

GET /user -> 200
GET /user/ -> 200 (as previously, or 404)

Actual behavior

GET /user -> 404
GET /user/ -> 200

Turns out this is the issue with registering controllers with @Get('/').

@JsonController('/user')
export class UserController {
  @Get('/')
  getUser() {}
}

When registering with ugly @Get('') it works properly.
Still it is a breaking change which was not disclosed in the CHANGELOG.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.