Options
All
  • Public
  • Public/Protected
  • All
Menu

Class App

The heart of your, well app. It all starts with new App(...)

Hierarchy

  • Hookable
    • App

Index

Constructors

constructor

  • The app constructor.

    Parameters

    • custom_config: PartialConfig

      Specify the details, such as database address and the port to listen on. This is private information and won't be shown to user. See Config

    • manifest: ManifestData

      Specify additional information, such as the URL, logo or the main color of the app. This is public information.

    Returns App

Properties

ConfigManager

ConfigManager: ConfigManager

ConfigManager instance. It serves the config based on default values and the config object provided to the app constructor

Context

Context: {}

A shorthand-way to create a new context: new app.Context().

Type declaration

Datastore

Datastore: Datastore

The mongoDB client connected to the database specified in the app config

Email

Email: Mailer

Mailer configured according to the app's config

HTTPServer

HTTPServer: HttpServer

The server that runs the REST API routing and allows to add custom routes etc

Logger

Logger: Logger

The Logger instance assigned to this application

RootSubject

RootSubject: Subject

The root subject of the app. It's where all subjects are derived from

SuperContext

SuperContext: {}

A shorthand-way to create a new SuperContext: new app.SuperContext().

Type declaration

collections

collections: {}

The collections defined within the given app.

Type declaration

hooks

hooks: Hook[] = []

i18n

i18n: (phrase_id: string, params?: any) => string

The function that's used to generate translated versions of phrases

Type declaration

    • (phrase_id: string, params?: any): string
    • Parameters

      • phrase_id: string
      • Optional params: any

      Returns string

manifest

manifest: Manifest

The manifest assigned to this app. Stores things like the app name, domain, logo

runAction

runAction: (context: Context, path: SubjectPathEquiv, action: ActionName, params?: any) => Promise<any>

Performs an action within an app. The action is specified by the subject path, parametrized with params and ran under the given context

Type declaration

status

status: "stopped" | "running" | "starting" | "stopping"

The current status of the app

Methods

addHook

  • Parameters

    Returns void

on

  • on(event_name: AppEvents, callback: () => void): Promise<void>
  • Allows to listen for basic app status change events

    Parameters

    • event_name: AppEvents
    • callback: () => void
        • (): void
        • Returns void

    Returns Promise<void>

start

  • start(): Promise<this>
  • Initializes all the collection fields, prepares all the hooks, connects to the database and starts the app, serving the REST API

    Returns Promise<this>

stop

  • stop(): Promise<void>
  • Stops the HTTP server, disconnects from the DB

    Returns Promise<void>

Generated using TypeDoc