---
lang: en
title: 'API docs: service-proxy.servicemixindoc.serviceprovider'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.service-proxy.servicemixindoc.serviceprovider.html
---

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

[Home](./index.md) &gt; [@loopback/service-proxy](./service-proxy.md) &gt; [ServiceMixinDoc](./service-proxy.servicemixindoc.md) &gt; [serviceProvider](./service-proxy.servicemixindoc.serviceprovider.md)

## ServiceMixinDoc.serviceProvider() method

Add a service to this application.

<b>Signature:</b>

```typescript
serviceProvider<S>(provider: Class<Provider<S>>): Binding<S>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  provider | <code>Class&lt;Provider&lt;S&gt;&gt;</code> | The service provider to register. |

<b>Returns:</b>

`Binding<S>`

## Example


```ts
export interface GeocoderService {
  geocode(address: string): Promise<GeoPoint[]>;
}

export class GeocoderServiceProvider implements Provider<GeocoderService> {
  constructor(
    @inject('datasources.geocoder')
    protected dataSource: juggler.DataSource = new GeocoderDataSource(),
  ) {}

  value(): Promise<GeocoderService> {
    return getService(this.dataSource);
  }
}

app.serviceProvider(GeocoderServiceProvider);

```


