Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koatty_core

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koatty_core - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

12

dist/Application.d.ts

@@ -0,1 +1,7 @@

/**
* @ author: richen
* @ copyright: Copyright (c) - <richenlin(at)gmail.com>
* @ license: BSD (3-Clause)
* @ version: 2020-07-06 11:21:37
*/
import Koa from "koa";

@@ -37,3 +43,3 @@ import { Application } from "koatty_container";

status: number;
Start: (openTrace: boolean, listenCallback: () => void) => void;
Start: (listenCallback: () => void) => void;
Stop: () => void;

@@ -172,3 +178,3 @@ }

*
* @param {Function} serve (app: Koatty, options: ListeningOptions, listenCallback: () => void) => void
* @param {Function} createServer (app: Koatty) => KoattyServer
* @param {Function} [listeningListener] () => void

@@ -178,3 +184,3 @@ * @returns {void} void

*/
listen(serve: any, listeningListener?: any): any;
listen(createServer: any, listeningListener?: any): any;
/**

@@ -181,0 +187,0 @@ * registration exception handling

@@ -11,3 +11,2 @@ "use strict";

*/
const fs_1 = tslib_1.__importDefault(require("fs"));
const koa_1 = tslib_1.__importDefault(require("koa"));

@@ -160,3 +159,3 @@ const Helper = tslib_1.__importStar(require("koatty_lib"));

*
* @param {Function} serve (app: Koatty, options: ListeningOptions, listenCallback: () => void) => void
* @param {Function} createServer (app: Koatty) => KoattyServer
* @param {Function} [listeningListener] () => void

@@ -166,33 +165,5 @@ * @returns {void} void

*/
listen(serve, listeningListener) {
var _a, _b, _c;
const protocol = this.config("protocol") || "http";
const port = process.env.PORT || process.env.APPPORT || this.config('app_port') || 3000;
const hostname = process.env.IP || ((_a = process.env.HOSTNAME) === null || _a === void 0 ? void 0 : _a.replace(/-/g, '.')) || this.config('app_host') || 'localhost';
const options = {
hostname: hostname,
port: port,
protocol: protocol,
ext: {
key: "",
cert: "",
protoFile: "",
}
};
const pm = new Set(["https", "http2", "wss"]);
if (pm.has(protocol)) {
const keyFile = (_b = this.config("key_file")) !== null && _b !== void 0 ? _b : "";
const crtFile = (_c = this.config("crt_file")) !== null && _c !== void 0 ? _c : "";
options.ext.key = fs_1.default.readFileSync(keyFile).toString();
options.ext.cert = fs_1.default.readFileSync(crtFile).toString();
}
if (protocol === "https" || protocol === "http2") {
options.port = options.port == 80 ? 443 : options.port;
}
if (protocol === "grpc") {
const proto = this.config("protoFile", "router");
options.ext.protoFile = proto;
}
serve(this, options, listeningListener(this, options));
return null;
listen(createServer, listeningListener) {
const server = createServer(this);
return server.Start(listeningListener);
}

@@ -199,0 +170,0 @@ /**

@@ -61,3 +61,3 @@ import Koa from "koa";

*/
export declare function CreateContext(ctx: Koa.Context, protocol?: string): KoattyContext;
export declare function CreateContext(ctx: Koa.Context): KoattyContext;
export {};

@@ -11,3 +11,3 @@ "use strict";

*/
function CreateContext(ctx, protocol) {
function CreateContext(ctx) {
const context = Object.create(ctx);

@@ -14,0 +14,0 @@ context.throw = function (statusOrMessage, codeOrMessage = 1, status) {

@@ -10,3 +10,3 @@ "use strict";

* @Date: 2021-11-16 14:46:22
* @LastEditTime: 2021-11-16 20:58:12
* @LastEditTime: 2021-11-16 21:17:23
*/

@@ -13,0 +13,0 @@ const events_1 = tslib_1.__importDefault(require("events"));

{
"name": "koatty_core",
"version": "1.2.3",
"version": "1.2.4",
"description": "Koatty routing component, adapt to http1/2, websocket, gRPC.",

@@ -5,0 +5,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc