Components

The various types

Throughout this documentation you will find references for four different types of components:

  • Route components
  • API components
  • Hybrid components
  • Custom components

It's important to understand that the differences are more conceptual than technical. While the default route component controller extends Unicore and the default API controller the used Frame, there is no necessity for this setup. Both an API component and a route component could either extend the used frame or the core's Serve class (if no providers are needed). Conceptually, however, we make the following distinctions:

Route components
are components with the purpose of being used as a SSR web-route. As such, they have a method init which ultimately executes a rendering mechanism (method output of the default renderer)

API components
are components with the purpose of being used as API endpoints. As such, they contain methods meant to be executed when certain http-methods are consumed.

Hybrid components
are components containing both, rendering capabilities as well as API endpoints. This can make sense in cases where neoan3 is used as a full stack solution or functionality can be either SSR rendered or provided through an API.

Custom components
are the only real outliers. While neoan3 has certain routing rules in place, the actual usage is quite unrestricted and depends on what you want to achieve and what technology is used.