UNPKG

@loopback/docs

Version:

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

43 lines (26 loc) 931 B
--- lang: en title: 'API docs: context.binding.to' keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI sidebar: lb4_sidebar editurl: https://github.com/strongloop/loopback-next/tree/master/packages/context permalink: /doc/en/lb4/apidocs.context.binding.to.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [Binding](./context.binding.md) &gt; [to](./context.binding.to.md) ## Binding.to() method Bind the key to a constant value. The value must be already available at binding time, it is not allowed to pass a Promise instance. <b>Signature:</b> ```typescript to(value: T): this; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | value | T | The bound value. | <b>Returns:</b> this ## Example ```ts ctx.bind('appName').to('CodeHub'); ```