@raprincis/service-broker
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Service Broker

Initialize a Service broker

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

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 */})

Readme

Keywords

Package Sidebar

Install

npm i @raprincis/service-broker

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

40.5 kB

Total Files

12

Last publish

Collaborators

  • raprincis