Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src
.npmrc
CHANGELOG.md
LICENSE
README.md
index.d.ts
index.js
index.ts
package-lock.json
package.json
tsconfig.build.json

README.md

@loopback/model-api-builder

Types and helpers for packages contributing Model API builders.

Overview

The @loopback/model-api-builder package provides a contract for extensions that contribute builders for repositories and controllers. Users provide both the model class and an extension. The extension is then used to build their repository and controller based on the model class.

Installation

npm install --save @loopback/model-api-builder

Basic use

An extension that contributes the repository and controller builders can be made by implementing ModelApiBuilder:

import {
  asModelApiBuilder,
  ModelApiBuilder,
  ModelApiConfig,
} from '@loopback/model-api-builder';

@bind(asModelApiBuilder)
export class SampleApiBuilder implements ModelApiBuilder {
  readonly pattern: string = 'Sample';

  build(
    application: ApplicationWithRepositories,
    modelClass: typeof Model & {prototype: Model},
    config: ModelApiConfig,
  ): Promise<void> {
    // define repository setup here
    // ...
    // define controller setup here
    // ...
  }
}

Contributions

Contributors

See all contributors.

License

MIT

You can’t perform that action at this time.