@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
43 lines (26 loc) • 931 B
Markdown
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) > [@loopback/context](./context.md) > [Binding](./context.binding.md) > [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');
```