Ng Rest
Powerful and flexible angular REST client. Fully abstraction layer.
How to use:
Step 0. Register services in AppModule
. src/app/app.module.ts
// ...,;
Step 1. Make a model. For example src/app/models/user.model.ts
; ;
Step 2. Make an api service. For example src/app/core/api/user-api.service.ts
; ;; ;; /** * User Api Service */
Step 3. Just use :)
// ...imoprt from 'ng-rest'; ;; // ...
F.A.Q.
-
How to add token to every request?
You need to do:- extend
RestRequestService
and overridebeforeSend
method. - register in
AppModule
and inject into every your*ApiService
your ownRestRequestService
instead of the service fromng-rest
Example:
;;; - extend
Todo
- make Model class as a separate package
- fix and add comments in the code
- write documentation
- configure trevis
- configure webpack
- make and commit a build
Yarn Warning: if you use yarn
instead of the npm
, please specify the exact version of the package.
For example 1.0.0-beta.4.4
without any ^
or ~
at the start.
It is need because yarn incorrect work with beta
sub-versions.
If you specify ^1.0.0-beta.4.0
then version 1.0.0.beta.1
will be installed.