UNPKG

@loopback/docs

Version:

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

72 lines (38 loc) 1.1 kB
--- 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/loopbackio/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. **Signature:** ```typescript to(value: T): this; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td markdown="1"> value </td><td markdown="1"> T </td><td markdown="1"> The bound value. </td></tr> </tbody></table> **Returns:** this ## Example ```ts ctx.bind('appName').to('CodeHub'); ```