Page Contents

Home > @loopback/context > BindingKey > create

BindingKey.create() method

Create a new key for a binding bound to a value of type ValueType.

Signature:

static create<ValueType>(key: string, propertyPath?: string): BindingKey<ValueType>;

Parameters

Parameter Type Description
key string The binding key. When propertyPath is not provided, the key is allowed to contain propertyPath as encoded via BindingKey#toString()
propertyPath string Optional path to a deep property of the bound value.

Returns:

BindingKey<ValueType>

Example

BindingKey.create<string>('application.name');
BindingKey.create<number>('config', 'rest.port);
BindingKey.create<number>('config#rest.port');