Skip to content

B. API Artifacts

Jonathan Casarrubias edited this page May 3, 2018 · 1 revision

OnixJS - Application Example

alt text

Welcome!, the following is a list of artifacts that can be implemented within your OnixJS Apps.

OnixJS API Artifacts

  • Application.- Uses the [@SOAService | @MSAService | @MVCApp] decorator and extends from the core Application Class in order to provide core functionalities. According to the Software Architecture that you choose to implement you'll be required to select one of the three options.
  • Router.- Uses the @Router decorator namespace, providing many middleware-related features like @Router.Use, @Router.Get, @Router.All, @Router.View and many more.
  • Injectables.- Uses the @Inject decorator namespace, providing some injection-related features, allowing you to inject @Inject.Service, @Inject.Model, @Inject.Renderer, @Inject.Notifier.
  • Renderers.- Uses the @ViewRenderer decorator, serving as a factory for registering template engines. These are mainly implemented in MVC Apps, though these are also available in any Architectural Pattern that OnixJS supports.
  • Notifier.- AppNotifier is an injectable @Inject.Notifier Object extending Event Emitter, it triggers app level related events. It will fire built-it events but it can also be used to communicate components using custom events (Custom events are only available in SOA and MVCApps).
  • Modules.- Uses the @Module decorator. Modules are software containers that integrate a related set of features within an application. These implements Models, Services, Components, Renderers and LifeCycles. Modules are not available for MSA.
  • Models.- Uses the @Model decorator and represents an Entity within your module scope. Models are singleton injectable objects that can be configured with any data source that the end developer decides or gets approved to use.
  • DataSources.- Uses the @DataSource decorator and serves as an ORM and Model Factory. End developer can configure data source connections and register models according to the selected ORM.
  • Services.- Injectable Services are singleton instances within a module context, it must not be confused with SOA Service or MicroService. Injectable Services will help end developers to provide common functionalities within a module context, but are only available for SOA and MVC Apps.
  • Components.- Uses the @Component decorator, is where the business logic of an application resides, Injectable models and services will commonly be injected within components. Component methods that are expected to be exposed can either use the @RPC, @Stream or @Router decorators in order to implement RPC, Real-Time, REST and to also register Views. In a MVC App, a component also represents a controller.
  • LifeCycles.- Are functions that can be installed either at module or component level, these works as not opinionated hooks. As the name refers, end developers are able to create lifecycles for each of their exposed methods (RPC/Stream Methods)
Clone this wiki locally