---
lang: en
title: 'API docs: service-proxy.servicemixindoc.serviceprovider'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/service-proxy
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: Constructor<Provider<S>>): Binding<S>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  provider | [Constructor](./context.constructor.md)<!-- -->&lt;[Provider](./context.provider.md)<!-- -->&lt;S&gt;&gt; | The service provider to register. |

<b>Returns:</b>

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

## 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);

```


