本文整理匯總了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 => {}));