kmathy / ngx-reduxor

ngx-reduxor: save time by generating ngrx architecture with no effort!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Service API needs prettier structure

jhcao23 opened this issue · comments

Improvement needed for Service Layer

In Service layer, something like return this.http.post('https://api.com', { body: param }):

  • first of all we might want to refer https://api.com to some const from environment.ts such as URL_REST_API.
  • for each service CRUD method, the template could possibly provide a default path after the URL_REST_API such as GET, CREATE, UPDATE, DELETE; then an example of addXXX might look like this:
addXXX(param: any): Observable<any> {
    return this.http.post(`${environment.URL_REST_API}/ADD`,  { body: param });
}
  • can we avoid the 'too general' parameter type (param: any) and use the actual target type XXX?
  • anyways, I feel the services still have room to improve. I will try to find a time to contribute on coding rather than talking.

Thanks,
John