• Checks if the given value is a valid port number.

    This is similar to the built-in @IsPort except that it requires the value to be a number (not a string).

    // Ensure the value is a valid network port (but not 0).
    @IsNetworkPort({ allow_system_allocated: false })
    remotePort: number

    Parameters

    • Optionaloptions: {
          allow_system_allocated?: boolean;
          allow_system_ports?: boolean;
      } & ValidationOptions

      Accepts the following options (in addition to generic class-validator options):

      • allow_system_allocated: boolean = true If true, allow port 0 (system allocated).
      • allow_system_ports: boolean = true If true, allow ports below 1024.

    Returns PropertyDecorator