import {PLATFORM_ROUTER_OPTIONS, PlatformHandler, PlatformRouter, PlatformStaticsOptions} from "@tsed/common";
import {Configuration, Inject} from "@tsed/di";
import * as Express from "express";
import {RouterOptions} from "express";
import {staticsMiddleware} from "../middlewares/staticsMiddleware";

declare global {
  namespace TsED {
    export interface Router extends Express.Router {}
  }
}

/**
 * @platform
 * @express
 */
export class PlatformExpressRouter extends PlatformRouter<Express.Router> {
  constructor(
    platform: PlatformHandler,
    @Configuration() configuration: Configuration,
    @Inject(PLATFORM_ROUTER_OPTIONS) routerOptions: Partial<RouterOptions> = {}
  ) {
    super(platform);

    const options = Object.assign(
      {
        mergeParams: true
      },
      configuration.express?.router || {},
      routerOptions
    );
    this.rawRouter = this.raw = Express.Router(options);
  }

  statics(endpoint: string, options: PlatformStaticsOptions) {
    const {root, ...props} = options;

    this.use(endpoint, staticsMiddleware(root, props));

    return this;
  }
}

import {InjectorService, PLATFORM_ROUTER_OPTIONS, PlatformHandler, PlatformRouter, PlatformStaticsOptions} from "@tsed/common";
import {Configuration, Inject} from "@tsed/di";
import * as Express from "express";
import {RouterOptions} from "express";
import {staticsMiddleware} from "../middlewares/staticsMiddleware";

declare global {
  namespace TsED {
    export interface Router extends Express.Router {}
  }
}

/**
 * @platform
 * @express
 */
export class PlatformExpressRouter extends PlatformRouter<Express.Router> {
  constructor(
    platform: PlatformHandler,
    @Configuration() configuration: Configuration,
    @Inject(PLATFORM_ROUTER_OPTIONS) routerOptions: Partial<RouterOptions> = {}
  ) {
    super(platform);

    const options = Object.assign({}, configuration.express?.router || {}, routerOptions);
    this.rawRouter = this.raw = Express.Router(options);
  }

  statics(endpoint: string, options: PlatformStaticsOptions) {
    const {root, ...props} = options;

    this.use(endpoint, staticsMiddleware(root, props));

    return this;
  }
}

--- 
+++ 
@@ -1,4 +1,4 @@
-import {InjectorService, PLATFORM_ROUTER_OPTIONS, PlatformHandler, PlatformRouter, PlatformStaticsOptions} from "@tsed/common";
+import {PLATFORM_ROUTER_OPTIONS, PlatformHandler, PlatformRouter, PlatformStaticsOptions} from "@tsed/common";
 import {Configuration, Inject} from "@tsed/di";
 import * as Express from "express";
 import {RouterOptions} from "express";
@@ -22,7 +22,13 @@
   ) {
     super(platform);
 
-    const options = Object.assign({}, configuration.express?.router || {}, routerOptions);
+    const options = Object.assign(
+      {
+        mergeParams: true
+      },
+      configuration.express?.router || {},
+      routerOptions
+    );
     this.rawRouter = this.raw = Express.Router(options);
   }
 
fix(platform-express): Set mergeStatic to true by default for express
