@feathersjs/feathers
- Version 4.5.15
- Published
- 87.2 kB
- 4 dependencies
- MIT license
Install
npm i @feathersjs/feathers
yarn add @feathersjs/feathers
pnpm add @feathersjs/feathers
Overview
A framework for real-time applications and REST API with JavaScript and TypeScript
Index
Variables
Interfaces
Type Aliases
Variables
variable createApplication
const createApplication: Feathers;
Interfaces
interface Application
interface Application<ServiceTypes = {}> extends EventEmitter {}
property methods
methods: string[];
property mixins
mixins: ServiceMixin[];
property services
services: keyof ServiceTypes extends never ? any : ServiceTypes;
property version
version: string;
method configure
configure: (callback: (this: this, app: this) => void) => this;
method disable
disable: (name: string) => this;
method disabled
disabled: (name: string) => boolean;
method enable
enable: (name: string) => this;
method enabled
enabled: (name: string) => boolean;
method get
get: (name: string) => any;
method hooks
hooks: (hooks: Partial<HooksObject>) => this;
method listen
listen: (port: number) => http.Server;
method service
service: { <L extends keyof ServiceTypes>(location: L): ServiceTypes[L]; (location: string): keyof ServiceTypes extends never ? any : never;};
method set
set: (name: string, value: any) => this;
method setup
setup: (server?: any) => this;
method use
use: ( path: string, service: Partial<ServiceMethods<any> & SetupMethod> | Application, options?: any) => this;
interface HookContext
interface HookContext<T = any, S = Service<T>> {}
property app
readonly app: Application;
A read only property that contains the Feathers application object. This can be used to retrieve other services (via context.app.service('name')) or configuration values.
property data
data?: T;
A writeable property containing the data of a create, update and patch service method call.
property dispatch
dispatch?: T;
A writeable, optional property and contains a 'safe' version of the data that should be sent to any client. If context.dispatch has not been set context.result will be sent to the client instead.
property error
error?: any;
A writeable property with the error object that was thrown in a failed method call. It is only available in error hooks.
property event
event?: null;
A writeable, optional property that allows service events to be skipped by setting it to
null
property id
id?: string | number;
A writeable property and the id for a get, remove, update and patch service method call. For remove, update and patch context.id can also be null when modifying multiple entries. In all other cases it will be undefined.
property method
readonly method: 'find' | 'get' | 'create' | 'update' | 'patch' | 'remove';
A read only property with the name of the service method (one of find, get, create, update, patch, remove).
property params
params: Params;
A writeable property that contains the service method parameters (including params.query).
property path
readonly path: string;
A read only property and contains the service name (or path) without leading or trailing slashes.
property result
result?: T;
A writeable property containing the result of the successful service method call. It is only available in after hooks.
context.result
can also be set in- A before hook to skip the actual service method (database) call - An error hook to swallow the error and return a result instead
property service
readonly service: S;
A read only property and contains the service this hook currently runs on.
property statusCode
statusCode?: number;
A writeable, optional property that allows to override the standard HTTP status code that should be returned.
property type
readonly type: 'before' | 'after' | 'error';
A read only property with the hook type (one of before, after or error).
interface HookMap
interface HookMap<T = any> {}
interface HooksObject
interface HooksObject<T = any> {}
interface Paginated
interface Paginated<T> {}
interface PaginationOptions
interface PaginationOptions {}
interface Params
interface Params {}
Service call parameters
See Also
property headers
headers?: { [key: string]: any };
property paginate
paginate?: false | Pick<PaginationOptions, 'max'>;
property provider
provider?: string;
property query
query?: Query;
property route
route?: { [key: string]: string };
property user
user?: { [key: string]: any };
index signature
[key: string]: any;
interface Query
interface Query {}
index signature
[key: string]: any;
interface ServiceAddons
interface ServiceAddons<T> extends EventEmitter {}
interface ServiceMethods
interface ServiceMethods<T> {}
method create
create: (data: Partial<T> | Partial<T>[], params?: Params) => Promise<T | T[]>;
Create a new resource for this service.
Parameter data
Data to insert into this service.
Parameter params
Service call parameters Params
See Also
method find
find: (params?: Params) => Promise<T | T[] | Paginated<T>>;
method get
get: (id: Id, params?: Params) => Promise<T>;
Retrieve a single resource matching the given ID.
Parameter id
ID of the resource to locate
Parameter params
Service call parameters Params
See Also
method patch
patch: (id: NullableId, data: Partial<T>, params?: Params) => Promise<T | T[]>;
Merge any resources matching the given ID with the given data.
Parameter id
ID of the resource to be patched
Parameter data
Data to merge with the current resource.
Parameter params
Service call parameters Params
See Also
method remove
remove: (id: NullableId, params?: Params) => Promise<T | T[]>;
Remove resources matching the given ID from the this service.
Parameter id
ID of the resource to be removed
Parameter params
Service call parameters Params
See Also
method update
update: (id: NullableId, data: T, params?: Params) => Promise<T | T[]>;
Replace any resources matching the given ID with the given data.
Parameter id
ID of the resource to be updated
Parameter data
Data to be put in place of the current resource.
Parameter params
Service call parameters Params
See Also
index signature
[key: string]: any;
interface ServiceOverloads
interface ServiceOverloads<T> {}
method create
create: { (data: Partial<T>, params?: Params): Promise<T>; (data: Partial<T>[], params?: Params): Promise<T[]>;};
Create a new resource for this service.
Parameter data
Data to insert into this service.
Parameter params
Service call parameters Params
See Also
method patch
patch: { (id: Id, data: Partial<T>, params?: Params): Promise<T>; (id: null, data: Partial<T>, params?: Params): Promise<T[]>;};
Merge any resources matching the given ID with the given data.
Parameter id
ID of the resource to be patched
Parameter data
Data to merge with the current resource.
Parameter params
Service call parameters Params
See Also
method remove
remove: { (id: Id, params?: Params): Promise<T>; (id: null, params?: Params): Promise<T[]>;};
Remove resources matching the given ID from the this service.
Parameter id
ID of the resource to be removed
Parameter params
Service call parameters Params
See Also
method update
update: { (id: Id, data: T, params?: Params): Promise<T>; (id: null, data: T, params?: Params): Promise<T[]>;};
Replace any resources matching the given ID with the given data.
Parameter id
ID of the resource to be updated
Parameter data
Data to be put in place of the current resource.
Parameter params
Service call parameters Params
See Also
interface SetupMethod
interface SetupMethod {}
method setup
setup: (app: Application, path: string) => void;
Type Aliases
type ClientSideParams
type ClientSideParams = Pick<Params, 'query' | 'paginate'>;
type Hook
type Hook<T = any, S = Service<T>> = ( context: HookContext<T, S>) => Promise<HookContext<T, S> | void> | HookContext<T, S> | void;
type Id
type Id = number | string;
type NullableId
type NullableId = Id | null;
type ServerSideParams
type ServerSideParams = Params;
type Service
type Service<T> = ServiceOverloads<T> & ServiceAddons<T> & ServiceMethods<T>;
type ServiceMixin
type ServiceMixin = (service: Service<any>, path: string) => void;
Package Files (1)
Dependencies (4)
Dev Dependencies (1)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@feathersjs/feathers
.
- Markdown[](https://www.jsdocs.io/package/@feathersjs/feathers)
- HTML<a href="https://www.jsdocs.io/package/@feathersjs/feathers"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 5748 ms. - Missing or incorrect documentation? Open an issue for this package.