WsRoute constructor

WsRoute(
  1. String path,
  2. WsHandler handler,
  3. WsAuthMiddleware? auth
)

Implementation

WsRoute(this.path, this.handler, this.auth) {
  final paramNames = <String>[];
  final regexPattern = path.replaceAllMapped(
    RegExp(r':(\w+)'),
    (m) {
      paramNames.add(m.group(1)!);
      return r'([^/]+)';
    },
  );
  _regex = RegExp('^$regexPattern\$');
  _params = paramNames;
}