toilrepo-inversify
v0.1.8
Published
OpenAPI client for toilrepo-inversify
Downloads
4
Maintainers
Readme
[email protected]
Building
To build and compile the typescript sources to javascript use:
npm install
npm run buildpublishing
First build the package than run npm publish
consuming
navigate to the folder of your consuming project and run one of next commando's.
published:
npm install [email protected] --saveunPublished (not recommended):
npm install PATH_TO_GENERATED_PACKAGE --saveusing npm link:
In PATH_TO_GENERATED_PACKAGE:
npm linkIn your project:
npm link [email protected]Requirements
Services require a IHttpClient and a IApiConfiguration. The IHttpClient is necessary to manage http's call and with the IApiConfiguration you can provide settings for the Authentication.
For the sake of simplicity an implementation of IHttpClient is already provided, but if you want you can override it.
For these reasons you have to manually bind these two services:
let container = new Container();
container.bind<IHttpClient>("IApiHttpClient").to(HttpClient).inSingletonScope();
container.bind<IApiConfiguration>("IApiConfiguration").to(ApiConfiguration).inSingletonScope();Services Binding
To bind all the generated services you can use ApiServiceBinder.
ApiServiceBinder.with(container);Final result
let container = new Container();
container.bind<IHttpClient>("IApiHttpClient").to(HttpClient).inSingletonScope();
container.bind<IApiConfiguration>("IApiConfiguration").to(ApiConfiguration).inSingletonScope();
ApiServiceBinder.with(container);