---
lang: en
title: 'API docs: core.createservicebinding'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/core
permalink: /doc/en/lb4/apidocs.core.createservicebinding.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/core](./core.md) &gt; [createServiceBinding](./core.createservicebinding.md)

## createServiceBinding() function

Create a service binding from a class or provider

**Signature:**

```typescript
export declare function createServiceBinding<S>(cls: ServiceOrProviderClass<S>, options?: ServiceOptions): Binding<S>;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

cls


</td><td>

[ServiceOrProviderClass](./core.serviceorproviderclass.md)<!-- -->&lt;S&gt;


</td><td>

Service class or provider


</td></tr>
<tr><td>

options


</td><td>

[ServiceOptions](./core.serviceoptions.md)


</td><td>

_(Optional)_ Service options


</td></tr>
</tbody></table>
**Returns:**

[Binding](./context.binding.md)<!-- -->&lt;S&gt;


