當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript common.MiddlewaresConsumer類代碼示例

本文整理匯總了TypeScript中@nestjs/common.MiddlewaresConsumer的典型用法代碼示例。如果您正苦於以下問題:TypeScript MiddlewaresConsumer類的具體用法?TypeScript MiddlewaresConsumer怎麽用?TypeScript MiddlewaresConsumer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了MiddlewaresConsumer類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: configure

  configure(consumer: MiddlewaresConsumer): void {

    consumer.apply(CorsMiddleware).forRoutes({
      path: '/*'
    });

    consumer.apply(OrgsMiddleware).forRoutes({
      path: '/*'
    });

    consumer.apply(AuthMiddleware).forRoutes({
      path: '/*'
    });

  }
開發者ID:hyperaudio,項目名稱:ha-api,代碼行數:15,代碼來源:app.module.ts

示例2: configure

  public configure(consumer: MiddlewaresConsumer) {
    consumer
      .apply(passport.authenticate('jwt', { session: false }))
      .forRoutes(
        { path: '/media', method: RequestMethod.POST },
        { path: '/media/*', method: RequestMethod.DELETE },
        { path: '/media/*', method: RequestMethod.PUT },

        { path: '/mixes', method: RequestMethod.POST },
        { path: '/mixes/*', method: RequestMethod.DELETE },
        { path: '/mixes/*', method: RequestMethod.PUT },

        { path: '/transcripts', method: RequestMethod.POST },
        { path: '/transcripts/*', method: RequestMethod.DELETE },
        { path: '/transcripts/*', method: RequestMethod.PUT },

        { path: '/accounts', method: RequestMethod.POST },
        { path: '/accounts/*', method: RequestMethod.DELETE },
        { path: '/accounts/*', method: RequestMethod.PUT },
      );

  }
開發者ID:hyperaudio,項目名稱:ha-api,代碼行數:22,代碼來源:auth.module.ts

示例3: configure

 configure(consumer: MiddlewaresConsumer) {
     consumer.apply(AuthMiddleware)
         .forRoutes({
             path: '*', method: RequestMethod.ALL
         });
 }
開發者ID:ddyrcz,項目名稱:Facebook,代碼行數:6,代碼來源:app.module.ts

示例4: configure

 configure(consumer: MiddlewaresConsumer): void {
   consumer.apply(ResponseMiddleware).forRoutes(
     { path: '*', method: RequestMethod.ALL } // Create application level middleware
   );
 }
開發者ID:bapinmalakar,項目名稱:nestjs-repo,代碼行數:5,代碼來源:app.module.ts

示例5: configure

 //全域middleware
 public configure(consumber: MiddlewaresConsumer) {
     //apply、forRoute方法允許傳入多個參數
     consumber.apply(passport.authenticate('jwt', { session: false }))
         .forRoutes({ path: '/users', method: RequestMethod.ALL });
 }
開發者ID:fanybook,項目名稱:Nestjs30Days,代碼行數:6,代碼來源:auth.module.ts


注:本文中的@nestjs/common.MiddlewaresConsumer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。