3.3.4 • Published 9 months ago

nest-utilities-client v3.3.4

Weekly downloads
64
License
ISC
Repository
github
Last release
9 months ago

Basic usage

The package revolves around the CrudService. Extending this service will grant you methods to call upon the endpoints generated by nest-utilities as well as the available query parameters.

import { CrudService } from "nest-utilities-client";
import { IUser } from "../interfaces"

class UserService extends CrudService<IUser> {
  constructor() {
    super("http://localhost:3000/users");
  }
}

HTTP service

Out of the box the CrudService will supplement your extended class with a basic HTTP service to execute your calls. In a lot of cases you'll want to create generic error handlers and define headers to send along with your requests.

You can customize the HTTP service by creating a new class which extends the HTTP service offered by the package. In this new class you will be prompted to implement abstract methods which help you tailor the service with ease.

import { HttpService } from "nest-utilities-client";
import { messageService } from "../services";

class CustomHttpService extends HttpService {
  getHeaders(url: string, init: RequestInit) {
    return {
      "Authorization": localStorage.session
    };
  }

  onRequestError(error: Error) {
    messageService.notify(error.message);
  }
}
import { CrudService } from "nest-utilities-client";
import { CustomHttpService } from "../services";
import { IUser } from "../interfaces"

class UserService extends CrudService<IUser> {
  constructor() {
    super("http://localhost:3000/users", new CustomHttpService());
  }
}
3.3.1

12 months ago

3.3.4

9 months ago

3.3.3

12 months ago

3.3.2

12 months ago

3.2.2

2 years ago

3.2.3

2 years ago

3.3.0

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.1.10

3 years ago

3.1.9

3 years ago

3.1.8

3 years ago

3.1.7

3 years ago

3.1.6

3 years ago

3.1.5

3 years ago

3.1.4

3 years ago

3.1.3

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

3.0.0-alpha.6

3 years ago

3.0.0-alpha.5

4 years ago

3.0.0-alpha.4

4 years ago

3.0.0-alpha.3

4 years ago

3.0.0-alpha.2

4 years ago

3.0.0-alpha.1

4 years ago

3.0.0-alpha.0

4 years ago

2.1.16

4 years ago

2.1.15

4 years ago

2.1.14

4 years ago

2.1.13

4 years ago

2.1.12

4 years ago

2.1.11

4 years ago

2.1.10

4 years ago

2.1.9

4 years ago

2.1.8

4 years ago

2.1.7

4 years ago

2.1.6

4 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.3

4 years ago

2.1.0

4 years ago

2.0.5

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.4

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.0

4 years ago