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


TypeScript Application.configure方法代碼示例

本文整理匯總了TypeScript中@feathersjs/feathers.Application.configure方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Application.configure方法的具體用法?TypeScript Application.configure怎麽用?TypeScript Application.configure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@feathersjs/feathers.Application的用法示例。


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

示例1: return

  return (app: Application) => {
    app.configure(channels());
    app.configure(routing());

    app.on('publish', getDispatcher(emit, socketKey));

    // `connection` event
    done.then(provider => provider.on('connection', (connection: any) =>
      app.emit('connection', getParams(connection)))
    );

    // `socket.emit('methodName', 'serviceName', ...args)` handlers
    done.then(provider => provider.on('connection', (connection: any) => {
      for (const method of app.methods) {
        connection.on(method, (...args: any[]) => {
          const path = args.shift();

          debug(`Got '${method}' call for service '${path}'`);
          runMethod(app, getParams(connection), path, method, args);
        });
      }
    }));

    // Legacy `socket.emit('serviceName::methodName', ...args)` handlers
    app.mixins.push((service, path) => done.then(provider => {
      provider.on('connection', (socket: any) => {
        const methods = app.methods.filter(current =>
          // @ts-ignore
          typeof service[current] === 'function'
        );

        for (const method of methods) {
          const eventName = `${path}::${method}`;

          socket.on(eventName, (...args: any[]) => {
            debug(`Got legacy method call '${eventName}'`);
            runMethod(app, getParams(socket), path, method, args);
          });
        }
      });
    }));
  };
開發者ID:feathersjs,項目名稱:feathers,代碼行數:42,代碼來源:index.ts

示例2: beforeEach

  beforeEach(() => {
    app = feathers();

    app.configure(client());
    app.use('/authentication', {
      create (data) {
        return Promise.resolve({
          accessToken,
          data,
          user
        });
      },

      remove (id) {
        return Promise.resolve({ id });
      }
    });
    app.use('dummy', {
      find (params) {
        return Promise.resolve(params);
      }
    });
  });
開發者ID:feathersjs,項目名稱:feathers,代碼行數:23,代碼來源:index.test.ts

示例3: getDefaultSettings

export const express = (settings: Partial<OauthSetupSettings> = {}) => (app: Application) => {
  const options = getDefaultSettings(app, settings);

  app.configure(setup(options));
  app.configure(setupExpress(options));
};
開發者ID:feathersjs,項目名稱:feathers,代碼行數:6,代碼來源:index.ts

示例4: io

import feathers, { Application } from '@feathersjs/feathers';
import feathersSocketIOClient from '@feathersjs/socketio-client';

import * as io from 'socket.io-client';

const socket = io();
const app: Application<{}> = feathers();

app.configure(feathersSocketIOClient(socket));
app.configure(feathersSocketIOClient(socket, { timeout: 1337 }));
開發者ID:AlexGalays,項目名稱:DefinitelyTyped,代碼行數:10,代碼來源:feathersjs__socketio-client-tests.ts

示例5: feathers

import feathers, { Application } from '@feathersjs/feathers';
import feathersSocketIO from '@feathersjs/socketio';

const app: Application<{}> = feathers();

app.configure(feathersSocketIO(1337, {}));
app.configure(feathersSocketIO(io => {}));
app.configure(feathersSocketIO({}, io => {}));
app.configure(feathersSocketIO(1337, io => {}));
app.configure(feathersSocketIO(1337, {}, io => {}));
開發者ID:AlexGalays,項目名稱:DefinitelyTyped,代碼行數:10,代碼來源:feathersjs__socketio-tests.ts


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