跳到主要内容
版本:Next

IMidwayBaseApplication <CTX>

Index

Methods

addConfigObject

  • addConfigObject(obj: any): any
  • Add new value to current config

createAnonymousContext

  • createAnonymousContext(...args: any[]): CTX
  • create a context with RequestContainer

createLogger

  • Create a logger by name and options

getAppDir

  • getAppDir(): string
  • Get a project root directory, without src or dist

getApplicationContext

  • Get global Midway IoC Container

getAttr

  • getAttr<T>(key: string): T
  • Get value from app attribute map


    Type parameters

    • T

getBaseDir

  • getBaseDir(): string
  • Get a base directory for project, with src or dist

getConfig

  • getConfig(key?: string): any
  • Get all configuration values or get the specified configuration through parameters

getCoreLogger

  • Get core logger

getEnv

  • getEnv(): string
  • Get a environment value, read from MIDWAY_SERVER_ENV

getFramework

  • get current related framework

getFrameworkType

  • @deprecated

    Get current framework type in MidwayFrameworkType enum

getLogger

  • Get default logger object or get the specified logger through parameters

getMiddleware

  • get global middleware


    Type parameters

    • R
    • N

getNamespace

  • getNamespace(): string
  • get current namespace

getProcessType

  • Get current running process type, app or agent, just for egg

getProjectName

  • getProjectName(): string
  • Get project name, just package.json name

setAttr

  • setAttr(key: string, value: any): any
  • Set value to app attribute map

setContextLoggerClass

  • setContextLoggerClass(BaseContextLoggerClass: any): void
  • Set a context logger class to change default context logger format

useFilter

  • add exception filter


    Type parameters

    • R
    • N

useGuard

  • add global guard

useMiddleware

  • add global filter to app


    Type parameters

    • R
    • N