1.3 Services

Services are reusable “classes” along with its associated properties and methods, that can be included via dependency injection into @Module / @Controller / @Filter or other service itself via @Provider.

If “classes” are annotated with @Injectable() or @Provider([]) they become visible to dependency injection system.

@Injectable() is same as @Provider([]).

If you want to declare dependencies that are created via dependency injection for that service on service level itself use @Provider([A, B]).

Simplest service:

import { Injectable } from "typeix";

@Injectable()
export class ServiceA {

}

Built-in Services:

  • Logger - Service responsible for logging
  • Router - Service responsible for routing
  • Request - Controller request limited api

results matching ""

    No results matching ""