3.2.0 • Published 6 years ago
crest-client v3.2.0
Crest Client
A starter for creating your own typescript client module for a Crest Compliant Server.
- Update package.json => change the package name to a private-scoped module
- Update package.json => change the git url
- Get the packages:
npm install
- Build your client
npm run down path/to/crest/server
- Publish your client:
npm login
,npm publish
down
will add the routes to the module.
Usage:
#In your client project:
npm login #Provide your user credentials.
npm install @myproject/crest-client --save
import { APIClient, MessageCategoryClass } from '@myproject/crest-client';
//TODO show how to implement this as APIService in an Angular project
//TODO provide clarification on httpMechansim and storageMechanism
let apiClient = new APIClient("http://localhost:3000", httpMechanism, storageMechanism);
let resultObservable<GetOutput<MessageCategoryClass.GetOutput>> = await apiClient.do('@/message/category', Method.GET, {
});
resultObservable.subscribe(messageCats => {
messageCats.list.forEach(cat => {
console.log(cat.name);
});
let idToFind = 10;
console.log('this is the entire MessageCategoryClass.GetOutput which has id 10', messageCats.index[10]);
})