Components

This page summarizes all the information about mandarine components and how & why they are used in Mandarine-powered applications.

What are components?

Mandarine has the concept of "components", components help diversify your application in different layers such as

  1. Configuration Layer

  2. Service Layer

  3. ORM Layer

  4. Others...

Components are used across Mandarine-powered applications mostly for dependency injection (DI) but its concept can go beyond, for example, Controllers are a type of component specifically created to handle HTTP requests (this if you are using Mandarine MVC).

Declaration

Components are declared by using typescript decorators (Click here to see more). All Component decorators should target a class.

Injecting objects

Most components accept the use of DI. DI can be achieved through class fields or by using constructor parameters.

Types of Components

See enum here

  • Controller

  • Middleware

  • Repository

  • Component

  • Service

  • Configuration

  • Manual Component

Last updated