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<V>(key: string, propertyPath?: string): BindingKey<V>;
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) Optional path to a deep property of the bound value. |
Returns:
BindingKey<V>
Example
BindingKey.create<string>('application.name');
BindingKey.create<number>('config', 'rest.port);
BindingKey.create<number>('config#rest.port');