# @raprincis/service-broker

> Osb api broker

Latest version **1.0.1** (published 2023-10-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @raprincis/service-broker
pnpm add @raprincis/service-broker
yarn add @raprincis/service-broker
bun add @raprincis/service-broker
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-10-09 |
| First published | 2023-10-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 39.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Princis RAKOTOMANGA |
| Maintainers | raprincis |
| Keywords | osbapi, cf, cloud foundry |

## Links

- npm: https://www.npmjs.com/package/@raprincis/service-broker
- Repository: https://github.com/raprins/service-broker
- Homepage: https://github.com/raprins/service-broker#readme
- Issues: https://github.com/raprins/service-broker/issues
- npm.io page: https://npm.io/package/@raprincis/service-broker

## Dependencies (4)

- [ajv](https://npm.io/package/ajv.md) ^8.12.0
- [zod](https://npm.io/package/zod.md) ^3.22.4
- [express](https://npm.io/package/express.md) ^4.18.2
- [jsonschema](https://npm.io/package/jsonschema.md) ^1.4.1

## Recent versions

- 1.0.1 (latest) — 2023-10-09
- 1.0.0 — 2023-10-09
- 0.0.9 — 2023-10-06
- 0.0.8 — 2023-10-06
- 0.0.7 — 2023-10-06
- 0.0.6 — 2023-10-06
- 0.0.5 — 2023-10-06
- 0.0.4 — 2023-10-05
- 0.0.3 — 2023-10-04
- 0.0.2 — 2023-10-04
- 0.0.1 — 2023-10-04

## README

# Service Broker

## Initialize a Service broker

```ts
const broker = Broker.create({
  // This must correspond to the credential when createing the OSB in CF
  withAuthentication: 'Basic someauthentication', 
  services: [new OsbService({
    id: 'fbb89e27-8b39-4aa4-b00a-415326185ea9',
    name: 'date-utilities',
    description: "Date",
    instances_retrievable: true,
    bindable: true,
    plans: [{
      id: 'd226e953-dcd6-4bf8-aa63-12ba196b7fb1',
      name: 'free-plan',
      description: 'A free plan',
      free: true
    }]
  })]
})

const PORT = Number(process.env.PORT || '3000')
const app = express()

app
  .use('/broker', broker.handler)
  .listen(PORT)

```

## Intercept call
For this case, extends the class __OsbService__ 

```ts
class DateService extends OsbService {
  
  // Handle Provision request
  provision(request: ProvisionRequest<CreateProvisioning<Record<string, any>>>): Provision {
    return {
      dashboard_url : 'http://localhost:3000/dashboard'
    }
  }
}


const dateService = new DateService({ /** Your configuration here */})
```

---
_Source: https://npm.io/package/@raprincis/service-broker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
