Skip to content

Built-in Middleware

Global Middleware

NameDescription
a-core:gateEnables the API to be effective in a specific runtime environment

System Middleware

NameDescription
a-core:notfound404
a-core:overrideMethod
a-instance:appReadyInitializes the app object
a-instance:instanceInitializes the instance object
a-logger:httpLogLog output
a-security:corsCORS
a-security:securitiesSecurities
a-static:staticProcesses static resources

a-core:gate

Enables the API to be effective in a specific runtime environment

NameTypeDescription
flavorstring|string[]See: Runtime Environments and Flavors
modestring|string[]See: Runtime Environments and Flavors
instanceNamestring|string[]See: Multi-Instance/Multi-Tenancy
hoststring|string[]Host
  • General usage:
typescript
import { Aspect } from 'vona-module-a-aspect';

@Aspect.middlewareGlobal('a-core:gate', {
  gate: {
    flavor: 'normal',
    mode: 'dev',
    instanceName: '',
    host: 'localhost:7102',
  },
})
  • Shorthand:
typescript
import { Core } from 'vona-module-a-core';

@Core.gate({
  gate: {
    flavor: 'normal',
    mode: 'dev',
    instanceName: '',
    host: 'localhost:7102',
  },
})
  • Shorthand principle:

@Core.gate still calls @Aspect.middlewareGlobal internally, the code is as follows:

typescript
function Gate(
  options?: Partial<TypeUseOnionOmitOptionsGlobal<IMiddlewareOptionsGate>>,
): ClassDecorator & MethodDecorator {
  return Aspect.middlewareGlobal('a-core:gate', options);
}

Released under the MIT License.