Skip to content

paramsForServer

Source Code | Documentation

See also: paramsFromClient

a hook to move params to query.$client the server only receives 'query' from params. All other params are ignored. So, to use $populateParams on the server, we need to move the params to query.$client the server will move them back to params

ts
  import { 
paramsForServer
} from 'feathers-utils/hooks';

Type declaration

ts
export type ParamsForServerOptions = {
  /**
   * @default '_$client'
   */
  keyToHide?: string
}
/**
 * a hook to move params to query._$client
 * the server only receives 'query' from params. All other params are ignored.
 * So, to use `$populateParams` on the server, we need to move the params to query._$client
 * the server will move them back to params
 *
 * @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
ArgumentTypeDescription
whitelistMaybeArray<string>
optionsParamsForServerOptions
typemethodsmulti
before, aroundcreate, update, patchyes

Released under the MIT License.