Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Platform

Tora 运行时。

Hierarchy

  • Platform

Index

Constructors

constructor

Properties

Private Optional _config_data

_config_data: ConfigData

Private _koa

_koa: ToraKoa = ...

Private _revolver

_revolver: Revolver = ...

Private _server

_server: ToraServer = ...

Private modules

modules: {} = {}

Type declaration

  • [prop: string]: any

Private root_injector

root_injector: Injector = ...

Private Readonly started_at

started_at: number

Methods

Private _get_providers

Private _mount_router

  • _mount_router(router_module: Type<any>, injector: Injector): void

Private _mount_task

  • _mount_task(trigger_module: Type<any>, injector: Injector): void

bootstrap

handle

import

koa_use

  • 直接暴露的 Koa.use 接口。
    考虑到可能需要使用一些 Koa 的插件。

    Parameters

    • middleware: (ctx: LiteContext, next: () => Promise<any>) => void
        • Parameters

          • ctx: LiteContext
          • next: () => Promise<any>
              • (): Promise<any>
              • Returns Promise<any>

          Returns void

    Returns Platform

load_config

  • load_config(file_path?: string): Platform
  • load_config(data: ToraConfigSchema): Platform

loading_message

  • 自定义启动信息。
    设计这个接口的目的是,有时候你可能需要知道程序启动时使用了哪些配置。

    Parameters

    Returns Platform

provide

register_module

  • register_module(name: string, module: any): Platform

route

select_module

  • select_module(keys: string[]): Platform

show_api_list

  • 列出全部 API 列表。

    Parameters

    • Optional formatter: (method: ApiMethod, path: string) => string

      自定义格式处理函数。

        • Parameters

          Returns string

    Returns Platform

show_task_list

  • show_task_list(formatter?: (task: { crontab: string; name: string; next_execution: string; pos: string }) => string): Platform
  • 展示任务列表,按执行顺序。

    Parameters

    • Optional formatter: (task: { crontab: string; name: string; next_execution: string; pos: string }) => string

      自定义格式处理函数。

        • (task: { crontab: string; name: string; next_execution: string; pos: string }): string
        • Parameters

          • task: { crontab: string; name: string; next_execution: string; pos: string }
            • crontab: string
            • name: string
            • next_execution: string
            • pos: string

          Returns string

    Returns Platform

start

  • start(): void

Generated using TypeDoc