@glandjs/http
Version:
A protocol adapter for HTTP built on top of the Gland architecture solution.
18 lines (17 loc) • 710 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerFactory = void 0;
const toolkit_1 = require("@medishn/toolkit");
class ServerFactory {
static create(options, listener) {
const isHttpsEnabled = options?.https;
this._logger.info(`Initializing ${isHttpsEnabled ? 'HTTPS' : 'HTTP'} server...`);
const serverModule = isHttpsEnabled ? require('https') : require('http');
if (isHttpsEnabled) {
return serverModule.createServer(options.https);
}
return serverModule.createServer(listener);
}
}
exports.ServerFactory = ServerFactory;
ServerFactory._logger = new toolkit_1.Logger({ context: 'HTTP:Server' });