# All files / core/helpers router-method-factory.ts

100% Statements 11/11
100% Branches 8/8
100% Functions 1/1
100% Lines 11/11

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    261x

    1x

    10x

    2x

    1x

    1x

    1x

    1x

    1x

    1x

    2x

     import { RequestMethod } from '@nestjs/common/enums/request-method.enum';

    export class RouterMethodFactory {
      public get(target, requestMethod: RequestMethod) {
        switch (requestMethod) {
          case RequestMethod.POST:
            return target.post;
          case RequestMethod.ALL:
            return target.use;
          case RequestMethod.DELETE:
            return target.delete;
          case RequestMethod.PUT:
            return target.put;
          case RequestMethod.PATCH:
            return target.patch;
          case RequestMethod.OPTIONS:
            return target.options;
          case RequestMethod.HEAD:
            return target.head;
          default: {
            return target.get;
          }
        }
      }
    }