本文整理汇总了TypeScript中@feathersjs/feathers.Application.setup方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Application.setup方法的具体用法?TypeScript Application.setup怎么用?TypeScript Application.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@feathersjs/feathers.Application
的用法示例。
在下文中一共展示了Application.setup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('passes when entity service exists and `entityId` property is set', () => {
app.get('authentication').entityId = 'id';
app.use('/users', {
async get () {
return {};
}
});
app.setup();
});
示例2: beforeEach
beforeEach(() => {
app = feathers();
app.use('/authentication', new AuthenticationService(app, 'authentication', {
entity: 'user',
service: 'users',
secret: 'supersecret',
authStrategies: [ 'first' ]
}));
app.use('/auth-v2', new AuthenticationService(app, 'auth-v2', {
entity: 'user',
service: 'users',
secret: 'supersecret',
authStrategies: [ 'test' ]
}));
app.use('/users', {
async find () {
return [];
},
async get (_id: string|number, params: Params) {
return params;
}
});
const service = app.service('authentication');
service.register('first', new Strategy1());
service.register('second', new Strategy2());
app.service('auth-v2').register('test', new Strategy1());
app.service('users').hooks({
before: {
get: authenticate('first', 'second')
}
});
app.service('users').id = 'name';
app.setup();
});