当前位置: 首页>>代码示例>>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;未经允许,请勿转载。