本文整理汇总了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);
});
}
});
}));
};
示例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);
}
});
});
示例3: getDefaultSettings
export const express = (settings: Partial<OauthSetupSettings> = {}) => (app: Application) => {
const options = getDefaultSettings(app, settings);
app.configure(setup(options));
app.configure(setupExpress(options));
};
示例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 }));
示例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 => {}));