25.0.0-beta.3 • Published 10 months ago
@contextjs/configuration-json v25.0.0-beta.3
@contextjs/configuration-json
JSON-based configuration provider for ContextJS applications.
Features
- Plug-and-play JSON configuration support
- Supports environment-specific configuration files
- Fully integrated with
@contextjs/configuration - Simple fluent API for loading files
Installation
npm i @contextjs/configuration-jsonQuick Start
Example json configuration file appsettings.json:
{
"App": {
"Port": 3000,
"Name": "My Application"
}
}Code:
import "@contextjs/configuration";
import "@contextjs/configuration-json";
import { Application, EnvironmentName } from "@contextjs/system";
const application = new Application();
application.useConfiguration(options => {
options.useJsonConfiguration(json => {
json.useFile("filepath/appsettings.json");
json.useFile("filepath/appsettings.development.json", "development");
json.useFile("filepath/appsettings.production.json", "production");
});
});
application.environment.name = EnvironmentName.production;
const port = await application.configuration.getValueAsync("App:Port");
console.log(`Starting server on port ${port}...`);API Reference
For detailed API documentation, please refer to the API Reference.
25.0.0-beta.3
10 months ago
25.0.0-beta.2
10 months ago
25.0.0-beta.1
10 months ago
0.5.3-alpha.1
10 months ago
0.5.2-alpha.1
10 months ago
0.5.1-alpha.1
11 months ago
0.5.0-alpha.1
11 months ago
0.4.8
11 months ago
0.4.7
11 months ago
0.4.6
12 months ago
0.4.5
12 months ago
0.4.4
12 months ago
0.4.3
12 months ago
0.4.2
12 months ago
0.4.1
12 months ago
0.4.0
12 months ago