Optional
serviceContainer: ServiceContainerOptional
appModule: AppModule<any, any>Protected
Optional
envReadonly
serviceOptional
token: string | number | bigint | boolean | symbol | RegExp | TypeNever | TypeAny | TypeUnknown | TypeVoid | TypeObject | TypeString | TypeNumber | TypeBoolean | TypeBigInt | TypeSymbol | TypeNull | TypeUndefined | TypeLiteral | TypeTemplateLiteral | TypeParameter | TypeFunction | TypeMethod | TypeProperty | TypePromise | TypeClass | TypeEnum | TypeEnumMember | TypeUnion | TypeIntersection | TypeArray | TypeObjectLiteral | TypeIndexSignature | TypePropertySignature | TypeMethodSignature | TypeTypeParameter | TypeInfer | TypeTuple | TypeTupleMember | TypeRest | TypeRegexp | Packed | T | ClassType<T> | AbstractClassType<T>Optional
moduleOrClass: AppModule<any, any> | ClassType<AppModule<any, any>>Loads environment variables and optionally reads from .env files in order to find matching configuration options in your application and modules in order to set their values.
Prefixing ENV variables is encouraged to avoid collisions and by default a prefix of APP_ is used Example:
APP_databaseUrl="mongodb://localhost/mydb"
new App({}).loadConfigFromEnvVariables('APP_').run();
envFilePath
can be either an absolute or relative path. For relative paths the first
folder with a package.json starting from process.cwd() upwards is picked.
So if you use 'local.env' make sure a 'local.env' file is located beside your 'package.json'.
Optional
options: EnvConfigOptionsConfiguration options for retrieving configuration from env
Loads a JSON encoded environment variable and applies its content to the configuration.
Example:
APP_CONFIG={'databaseUrl": "mongodb://localhost/mydb", "moduleA": {"foo": "bar'}}
new App().run().loadConfigFromEnvVariable('APP_CONFIG').run();
Static
fromGenerated using TypeDoc
This is the smallest available application abstraction in Deepkit.
It is based on a module and executes registered CLI controllers in
execute
.@deepkit/framework extends that with a more powerful Application class, that contains also HTTP and RPC controllers.
You can use this class for more integrated unit-tests.