RESTFUL model
REST based models

Overview

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.

Initialize

For setting model of this type all you need to do is:
  1. 1.
    Extend the ModelAbstract class
  2. 2.
    Define the CRUD Logic

Example

1
export class MicroServiceModel extends ModelAbstract{
2
public name:string;
3
4
constructor(name:string){
5
super();
6
this.name = name;
7
}
8
9
protected saveEmitter(options?: any): Promise<any> {
10
return rp({
11
method:"POST",
12
body:this
13
});
14
}
15
// other CRUD actions implementation
16
17
}
Copied!
Last modified 2yr ago
Copy link