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.1.4 to 1.1.5

80

dist/Application.d.ts

@@ -1,2 +0,1 @@

/// <reference types="node" />
/**

@@ -9,9 +8,7 @@ * @ author: richen

import Koa from "koa";
import { IncomingMessage, ServerResponse } from 'http';
import { Application } from "koatty_container";
import { KoattyContext } from "./Context";
/**
* InitOptions
*
*
* @export
* @interface InitOptions

@@ -26,2 +23,64 @@ */

/**
* listening options
*
* @interface ListeningOptions
*/
export interface ListeningOptions {
hostname: string;
port: number;
protocol: string;
ext?: any;
}
/**
* interface Server
*
* @export
* @interface KoattyServer
*/
export interface KoattyServer {
Start: (openTrace: boolean, listenCallback: () => void) => void;
Stop: () => void;
}
/**
* KoattyRouterOptions
*
* @export
* @interface KoattyRouterOptions
*/
export interface KoattyRouterOptions {
prefix: string;
/**
* Methods which should be supported by the router.
*/
methods?: string[];
routerPath?: string;
/**
* Whether or not routing should be case-sensitive.
*/
sensitive?: boolean;
/**
* Whether or not routes should matched strictly.
*
* If strict matching is enabled, the trailing slash is taken into
* account when matching routes.
*/
strict?: boolean;
protoFile?: string;
protocol: string;
}
/**
* Router interface
*
* @export
* @interface KoattyRouter
*/
export interface KoattyRouter {
app: Koatty;
options: any;
router: any;
SetRouter: (path: string, func: Function, method?: any) => void;
ListRouter: () => any;
LoadRouter: (list: any[]) => void;
}
/**
* Application

@@ -38,2 +97,4 @@ * @export

context: KoattyContext;
server: KoattyServer;
router: KoattyRouter;
appPath: string;

@@ -101,4 +162,13 @@ rootPath: string;

*/
createContext(req: IncomingMessage, res: ServerResponse): KoattyContext;
createContext(req: any, res: any): KoattyContext;
/**
* listening and start server
*
* @param {Function} serve (app: Koatty, options: ListeningOptions, listenCallback: () => void) => void
* @param {Function} [listeningListener] () => void
* @returns {void} void
* @memberof Koatty
*/
listen(serve: any, listeningListener?: any): any;
/**
* registration exception handling

@@ -105,0 +175,0 @@ *

@@ -48,2 +48,8 @@ "use strict";

this.captureError();
// path check
if (Helper.isEmpty(this.rootPath) ||
Helper.isEmpty(this.appPath) ||
Helper.isEmpty(this.thinkPath)) {
throw new Error("rootPath and appPath not defined");
}
}

@@ -156,2 +162,30 @@ /**

/**
* listening and start server
*
* @param {Function} serve (app: Koatty, options: ListeningOptions, listenCallback: () => void) => void
* @param {Function} [listeningListener] () => void
* @returns {void} void
* @memberof Koatty
*/
listen(serve, listeningListener) {
var _a;
const protocol = this.config("protocol") || "http"; // 'http' | 'https' | 'grpc' | 'ws' | 'wss'
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,
// listenUrl: `${protocol}://${hostname || '127.0.0.1'}:${port}/`,
ext: {
// key: "",
// cert: "",
// protoFile: "",
},
};
// serve and start
serve(this, options, listeningListener);
return null;
}
/**
* registration exception handling

@@ -158,0 +192,0 @@ *

8

package.json
{
"name": "koatty_core",
"version": "1.1.4",
"version": "1.1.5",
"description": "Koatty routing component, adapt to http1/2, websocket, gRPC.",

@@ -10,3 +10,3 @@ "scripts": {

"release": "standard-version",
"test": "npm run eslint && npm run build && jest --passWithNoTests",
"test": "npm run eslint && jest --passWithNoTests",
"test:cov": "jest --collectCoverage --detectOpenHandles",

@@ -58,3 +58,3 @@ "version": "conventional-changelog -p angular -i CHANGELOG.md -s"

"koatty_trace": "^1.x.x",
"tslib": "^2.3.0"
"tslib": "^2.3.1"
},

@@ -66,2 +66,2 @@ "husky": {

}
}
}

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