Core Initialization

This page summarizes how and when the core initialization is needed & why it is used.

Main

The core initialization is responsible for unifying all mandarine modules (Core, MVC, Security, Data) into one as it handles some of the most important tasks inside the framework such as:

  • Dependency Initialization

  • Controllers' initialization

  • Templates' initialization

  • Repositories' proxy connector

  • Initialization of entity manager

    • Responsible for handling the use of data sources.

The core initialization is also responsible for creating a bridge between Mandarine's internal core & Mandarine's MVC Core.

Usage

In order to invoke the initialization of Mandarine's core, this is what you would have to do.

import { MandarineCore } from "https://deno.land/x/mandarinets/mod.ts";

/**
 * Code
 */
 
 new MandarineCore();

Single entry-point file

The single entry point file serves as an index for all your Mandarine-powered components as well as modules that are not written in Mandarine but are required in certain sections of your Mandarine-powered application.

import { MandarineCore } from "https://deno.land/x/mandarinets/mod.ts";

const services = [/* Unitialized Instances / Classes */];
const middleware = [/* Unitialized Instances / Classes */];
const repositories = [/* Unitialized Instances / Classes */];
const configurations = [/* Unitialized Instances / Classes */];
const components = [/* Unitialized Instances / Classes */];
const otherModules = [/* Unitialized Instances / Classes */];

new MandarineCore();

Note that you should not pass initialized instances in the entry-point variables as shown above, you should only pass the reference.

MVC Bridge

If your application is a Mandarine's web MVC application, you would start it like this:

import { MandarineCore } from "https://deno.land/x/mandarinets/mod.ts";

/**
 * Code
 * Or Single entry-point File
 */
 
 new MandarineCore().MVC().run();

For more information on how to initialize a Mandarine-powered application with multiple file references or a Mandarine-powered web application click here

Last updated