finnow/finnow-api/source/app.d

32 lines
771 B
D

import handy_http_transport;
import slf4d;
import slf4d.default_provider;
import api_mapping;
import util.config;
import scheduled_jobs;
/**
* Starts the Finnow API.
*/
void main() {
const config = readConfig();
configureSlf4d(config);
startScheduledJobs();
startWebServer(config);
}
void configureSlf4d(in AppConfig config) {
Level logLevel = getConfiguredLoggingLevel(config);
logLevel = Levels.DEBUG;
auto provider = new DefaultProvider(logLevel);
configureLoggingProvider(provider);
}
void startWebServer(in AppConfig config) {
Http1TransportConfig transportConfig = defaultConfig();
transportConfig.port = config.port;
HttpTransport transport = new TaskPoolHttp1Transport(mapApiHandlers(config.webOrigin), transportConfig);
transport.start();
}