UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

45 lines (29 loc) 1.33 kB
--- lang: en title: 'API docs: context.bindingkey.create' keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI sidebar: lb4_sidebar editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context permalink: /doc/en/lb4/apidocs.context.bindingkey.create.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [BindingKey](./context.bindingkey.md) &gt; [create](./context.bindingkey.create.md) ## BindingKey.create() method Create a new key for a binding bound to a value of type `ValueType`<!-- -->. <b>Signature:</b> ```typescript 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 <code>BindingKey#toString()</code> | | propertyPath | string | Optional path to a deep property of the bound value. | <b>Returns:</b> [BindingKey](./context.bindingkey.md)<!-- -->&lt;V&gt; ## Example ```ts BindingKey.create<string>('application.name'); BindingKey.create<number>('config', 'rest.port); BindingKey.create<number>('config#rest.port'); ```