paramsForServer
Source Code | DocumentationSee also: hooks/paramsFromClient
Client-side hook that moves whitelisted params properties into query._$client so they survive the client-to-server transport. The server only receives query from params — use paramsFromClient on the server to restore them.
ts
import { paramsForServer } from 'feathers-utils/hooks';Example
ts
import { paramsForServer } from 'feathers-utils/hooks'
// Client-side
app.service('users').hooks({
before: { all: [paramsForServer('populateParams')] }
})Type declaration
Show Type Declarations
ts
export type ParamsForServerOptions = {
/**
* @default '_$client'
*/
keyToHide?: string
}
/**
* Client-side hook that moves whitelisted `params` properties into `query._$client`
* so they survive the client-to-server transport. The server only receives `query`
* from params — use `paramsFromClient` on the server to restore them.
*
* @example
* ```ts
*
*
* // Client-side
* app.service('users').hooks({
* before: { all: [paramsForServer('populateParams')] }
* })
* ```
*
* @see https://utils.feathersjs.com/hooks/params-for-server.html
*/
export declare const paramsForServer: (
whitelist: MaybeArray<string>,
options?: ParamsForServerOptions,
) => <H extends HookContext>(context: H, next?: NextFunction) => any| Argument | Type | Description |
|---|---|---|
| whitelist | MaybeArray<string> | |
| options | ParamsForServerOptions |
| type | methods | multi |
|---|---|---|
| before, around | create, update, patch | yes |
