docs

Services

Our code generator will generate 2 approaches for services: a single-file or a multiple-files approach. The service in a single file has each method as a functionality, but if you choose the multiple-files approach, each file will contain a single method. The service as a single file is a class and can have as many functions as you want, but if you generate the service using the command line, by default, the functions created alongside the service are:

For the single-file approach, the command line will generate file with a class that can have as many functions as you want, and by default, the functions created alongside the service are:

For the multiple-files approach, the command line will generate a folder with the name you chose, containing the files:

You can import the AppError interface from within @hefestos/core to trigger specific errors, for example: import { AppError } from "@hefestos/core";.

An example of using AppError would be if a specific user was not found: if (!user) throw AppError.E_NOT_FOUND();

Read more about AppError.

Summary