---
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 markdown="1">

cls


</td><td markdown="1">

[ServiceOrProviderClass](./core.serviceorproviderclass.md)<!-- -->&lt;S&gt;


</td><td markdown="1">

Service class or provider


</td></tr>
<tr><td markdown="1">

options


</td><td markdown="1">

[ServiceOptions](./core.serviceoptions.md)


</td><td markdown="1">

_(Optional)_ Service options


</td></tr>
</tbody></table>

**Returns:**

[Binding](./context.binding.md)<!-- -->&lt;S&gt;


