UNPKG

@dooboostore/simple-boot-http-server

Version:

back end http server frameworks

35 lines 1.63 kB
import { SimOption } from '@dooboostore/simple-boot/SimOption'; export class HttpServerOption extends SimOption { constructor({ serverOption, listen, filters, requestEndPoints, closeEndPoints, errorEndPoints, sessionOption, globalAdvice, fileUploadTempPath, noSuchRouteEndPointMappingThrow, transactionManagerFactory } = {}, initSimOption) { super(initSimOption); this.serverOption = serverOption; this.listen = Object.assign({ port: HttpServerOption.DEFAULT_PORT, hostname: HttpServerOption.DEFAULT_HOSTNAME }, listen); this.filters = filters; this.requestEndPoints = requestEndPoints; this.closeEndPoints = closeEndPoints; this.errorEndPoints = errorEndPoints; this.sessionOption = Object.assign({ key: 'SBSESSIONID', expiredTime: 1000 * 60 * 30 }, sessionOption); this.globalAdvice = globalAdvice; this.fileUploadTempPath = fileUploadTempPath; this.noSuchRouteEndPointMappingThrow = noSuchRouteEndPointMappingThrow; this.transactionManagerFactory = transactionManagerFactory; } get hostname() { return this.listen.hostname; } get port() { return this.listen.port; } get protocol() { return this.isSecure ? 'https' : 'http'; } get address() { return `${this.protocol}://${this.hostname}:${this.port}`; } get isSecure() { return this.serverOption && 'key' in this.serverOption && 'cert' in this.serverOption; } } HttpServerOption.DEFAULT_PORT = 8081; HttpServerOption.DEFAULT_HOSTNAME = '127.0.0.1'; //# sourceMappingURL=HttpServerOption.js.map