protected function loadRoutes(string $filename)
  {
    $filename = realpath($filename);

    if ( file_exists($filename) ) {
      $routesFile = json_decode( file_get_contents($filename), true );
      if ($routesFile) {
        $routeGroups = $routesFile['groups'] ?? [];
        # Add each RouteGroup
        foreach ($routeGroups as $routeGroupDef)
        {
          # Create new Route Group
          $routeGroup = new \Nofuzz\Route\Group($routeGroupDef);

          # Add to list
          $this->routeGroups[] = $routeGroup;
        }

        # Common Middlewares
        $this->beforeMiddleware = ($routesFile['common']['before'] ?? []);
        $this->afterMiddleware = ($routesFile['common']['after'] ?? []);
      } else {
        throw new \RunTimeException('Invalid JSON file "'.$filename.'"');

      }

      # Debug log
      $this->getLogger()->debug('Loaded routes',['file'=>$filename]);

      return true; // routes added
    }

    return false; // file not found
  }