Mandarine.TS
Latest
Latest
  • Mandarine.TS
  • Getting started
    • Installing Deno Runtime
    • Setting up Environment
    • Quick Example
  • Concepts
  • Mandarine Project Structure
  • Mandarine CLI
    • CLI Reference
      • mandarine new
      • mandarine generate
      • mandarine run
  • Mandarine Core
    • Core Initialization
    • Mandarine.json
    • Dot env file
    • Properties
      • The @Value Decorator
    • Components
      • Controller
      • Middleware
      • Repository
      • Component
      • Service
      • Configuration
      • Manual Component
    • Dependency Injection
      • Accessing DI container
    • Resource Handlers
      • Resource Handler Registry
      • Resource Handler
      • Resource Resolver
  • Mandarine MVC
    • Web MVC
    • Controllers
      • Routes
        • Parameterized Routes
      • HTTP Handlers
      • @ResponseStatus
    • Custom Middleware
    • Session Middleware
    • CORS Middleware
    • Template Engine
      • @Render Decorator
      • Accessing data from template
    • Launching web-app
    • Serving Static Content
    • Multipart Form Data
  • Mandarine Security
    • Sessions
  • Mandarine Data
    • ORM
      • Data source
      • Models
      • Repositories
        • Interacting with data
        • Updating data
    • Mandarine Query Language
  • Resources
    • Changelog
  • Plugins
    • Optional
    • Promise Repeater
Powered by GitBook
On this page
  • Main
  • Usage
  • Single entry-point file
  • MVC Bridge

Was this helpful?

  1. Mandarine Core

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();
Previousmandarine runNextMandarine.json

Last updated 5 years ago

Was this helpful?

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

click here