simple-boot-http-server
Advanced tools
Comparing version 1.0.0 to 1.0.1
/// <reference types="node" /> | ||
import { Router } from '../router/Router'; | ||
import { SimOption } from 'simple-boot-core/SimOption'; | ||
@@ -13,7 +12,5 @@ import { ConstructorType } from 'simple-boot-core/types/Types'; | ||
export declare class HttpServerOption extends SimOption { | ||
rootRouter: ConstructorType<Router>; | ||
serverOption?: ServerOptions; | ||
listen: Listen; | ||
constructor(rootRouter: ConstructorType<Router>, advice?: ConstructorType<any>[]); | ||
setRootRouter(rootRouter: ConstructorType<Router>): HttpServerOption; | ||
constructor(advice?: ConstructorType<any>[]); | ||
} |
@@ -22,15 +22,10 @@ "use strict"; | ||
__extends(HttpServerOption, _super); | ||
function HttpServerOption(rootRouter, advice) { | ||
function HttpServerOption(advice) { | ||
if (advice === void 0) { advice = []; } | ||
var _this = _super.call(this, advice) || this; | ||
_this.rootRouter = rootRouter; | ||
_this.listen = { port: 8081 }; | ||
return _this; | ||
} | ||
HttpServerOption.prototype.setRootRouter = function (rootRouter) { | ||
this.rootRouter = rootRouter; | ||
return this; | ||
}; | ||
return HttpServerOption; | ||
}(SimOption_1.SimOption)); | ||
exports.HttpServerOption = HttpServerOption; |
{ | ||
"name": "simple-boot-http-server", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "SimpleHttpServerApplication.js", | ||
@@ -56,3 +56,3 @@ "license": "MIT", | ||
"npm-publish": "npm run npm-build && npm publish ./dist", | ||
"dev": "", | ||
"dev": "npm run dev --workspace=dev", | ||
"tsc": "tsc", | ||
@@ -82,4 +82,4 @@ "test": "jest --detectOpenHandles --forceExit" | ||
"rxjs": "^6.6.7", | ||
"simple-boot-core": "^1.0.5" | ||
"simple-boot-core": "^1.0.7" | ||
} | ||
} |
@@ -1,7 +0,7 @@ | ||
import { Router } from './Router'; | ||
import { ReceiveModule } from "../module/ReceiveModule"; | ||
import { HttpRouter } from './HttpRouter'; | ||
import { HttpModule } from "../module/HttpModule"; | ||
export declare class RouterModule { | ||
router?: Router | undefined; | ||
module?: ReceiveModule | undefined; | ||
constructor(router?: Router | undefined, module?: ReceiveModule | undefined); | ||
router?: HttpRouter | undefined; | ||
module?: HttpModule | undefined; | ||
constructor(router?: HttpRouter | undefined, module?: HttpModule | undefined); | ||
} |
import { SimpleApplication } from 'simple-boot-core/SimpleApplication'; | ||
import { HttpServerOption } from "./option/HttpServerOption"; | ||
import { RouterManager } from "./router/RouterManager"; | ||
import { HttpRouter } from "./router/HttpRouter"; | ||
import { ConstructorType } from "simple-boot-core/types/Types"; | ||
export declare class SimpleBootHttpServer extends SimpleApplication { | ||
rootRouter: ConstructorType<HttpRouter>; | ||
option: HttpServerOption; | ||
routerManager: RouterManager; | ||
constructor(option: HttpServerOption); | ||
constructor(rootRouter: ConstructorType<HttpRouter>, option: HttpServerOption); | ||
run(): void; | ||
} |
@@ -17,32 +17,13 @@ "use strict"; | ||
})(); | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SimpleBootHttpServer = void 0; | ||
var SimpleApplication_1 = require("simple-boot-core/SimpleApplication"); | ||
var RouterManager_1 = require("./router/RouterManager"); | ||
var http = __importStar(require("http")); | ||
var http_1 = require("http"); | ||
var Intent_1 = require("simple-boot-core/intent/Intent"); | ||
var SimpleBootHttpServer = (function (_super) { | ||
__extends(SimpleBootHttpServer, _super); | ||
function SimpleBootHttpServer(option) { | ||
var _this = _super.call(this, option) || this; | ||
function SimpleBootHttpServer(rootRouter, option) { | ||
var _this = _super.call(this, rootRouter, option) || this; | ||
_this.rootRouter = rootRouter; | ||
_this.option = option; | ||
_this.routerManager = new RouterManager_1.RouterManager(_this.option, _this.simstanceManager); | ||
return _this; | ||
@@ -53,14 +34,13 @@ } | ||
_super.prototype.run.call(this); | ||
this.routerManager.run(); | ||
var server; | ||
if (this.option.serverOption) { | ||
server = http.createServer(this.option.serverOption, function (req, res) { | ||
_this.routerManager.executeRouter(req, res); | ||
var server = this.option.serverOption ? new http_1.Server(this.option.serverOption) : new http_1.Server(); | ||
server.on('request', function (req, res) { | ||
var _a; | ||
var intent = new Intent_1.Intent((_a = req.url) !== null && _a !== void 0 ? _a : ''); | ||
_this.routing(intent).then(function (it) { | ||
var _a; | ||
(_a = it.getModuleInstance()) === null || _a === void 0 ? void 0 : _a.receive(req, res); | ||
}).catch(function (it) { | ||
console.log('catch-->', it); | ||
}); | ||
} | ||
else { | ||
server = http.createServer(function (req, res) { | ||
_this.routerManager.executeRouter(req, res); | ||
}); | ||
} | ||
}); | ||
server.listen(this.option.listen.port, this.option.listen.hostname, this.option.listen.backlog, this.option.listen.listeningListener); | ||
@@ -67,0 +47,0 @@ }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
11487
12
195
2
Updatedsimple-boot-core@^1.0.7