app config - mindsers/yabf GitHub Wiki
Represents the configuration options for a WebApplication.
interface IAppConfig {
server: {
port: number;
}
cors?: {
activated?: boolean;
headers?: string[];
origins: string[];
}
assets?: {
location: string;
}
locales?: {
list?: string[];
default?: string;
}
}
You can inject a configuration object in your web application using the key APP_CONFIG
. This object must follow this interfaces.
const app = WebApplication.createInstance()
const config: AppConfig = {
server: {
port: 3000
},
locales: {
default: 'de',
list: ['en', 'de', 'fr']
}
}
app.provide({ provide: APP_CONFIG, useValue: config })
app.start()
-
server.port
: (required) The port number listen by the server. Set to8080
by default. -
assests.location
: The path where are stored your assets. -
locales.list
: Locale list supported by your application. Set to['en']
by default. -
locale.default
: Primary locale of your application. Set to the first element oflocales.list
by default. -
cors.activated
: Set or unset the CORS support for your application. Set totrue
by default. -
cors.headers
: List of allowed headers. -
cors.origins
: List of allowed origins.