RESTFUL model
REST based models
Models of this type don't have direct connection to the storage unit. Therefore, the communication is done by a single request each time and the connection is closed as soon as the request is completed.
Common usage is RESTful requests.
For setting model of this type all you need to do is:
- 1.Extend the
ModelAbstract
class - 2.
export class MicroServiceModel extends ModelAbstract{
public name:string;
constructor(name:string){
super();
this.name = name;
}
protected saveEmitter(options?: any): Promise<any> {
return rp({
method:"POST",
body:this
});
}
// other CRUD actions implementation
}
Last modified 4yr ago