npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gzwebsj-router

v0.0.1

Published

轻量级微服务 @ Email://[email protected]

Downloads

2

Readme

项目目录一览

├── README.md
├── dist
│   ├── index.js
│   ├── router
│   │   ├── index.js
│   │   ├── router.js
│   │   ├── router_event
│   │   │   └── event.js
│   │   ├── router_exception
│   │   │   └── exception.js
│   │   └── router_utils
│   │       └── index.js
│   └── utils
│       ├── index.js
│       └── types
│           └── index.js
├── index.d.ts
├── index.js
├── index.ts
├── package-lock.json
├── package.json
├── router
│   ├── index.js
│   ├── index.ts
│   ├── router.js
│   ├── router.ts
│   ├── router_event
│   │   ├── event.js
│   │   ├── event.ts
│   │   ├── index.d.js
│   │   └── index.d.ts
│   ├── router_exception
│   │   ├── exception.ts
│   │   └── index.d.ts
│   └── router_utils
│       ├── index.js
│       └── index.ts
├── test
├── tsconfig.json
└── utils
    ├── index.js
    ├── index.ts
    └── types
        ├── index.js
        └── index.ts

项目简介

项目名称:gzwebsj-router

项目版本:v0.0.1

项目作者: [email protected]

项目使用说明

框架使用nodejs HttpServer2+架构,轻量级的微服务框架!

router_event 事件监听器

主指针函数:
ROUTER_EVENT
handler(method: string, path: string, req: Http2ServerRequest, res: Http2ServerResponse, d: object, callback: (val: any, d: object, cb: () => {}, req: Http2ServerRequest, res: Http2ServerResponse) => {}): Promise<object>

进程监听器和事件监听器:
ROUTER_EVENT
addListener(event_name: string, router_name: string, option: { timeout: number; callback: (...args: any[]) => void}): any

事件钩子
ROUTER_EVENT
eventHook(event_name: string, request: Http2ServerRequest, response: Http2ServerResponse, option: { hook_name: string; data: object; callback: (...args: any[]) => void }): any

路由标示
ROUTER_EVENT
async signal(url: string, signal: AbortSignal): Promise<any>

router 主函数

路由初始化监听器
ROUTER
router_initListener(host: string, port: number, req: Http2ServerRequest): Promise<object> 

路由监听器
ROUTER
router_Listener(req: Http2ServerRequest): void

路由跨域
ROUTER
setAccess(response: Http2ServerResponse): void

路由
ROUTER
router(method: string, url: string, URL: string, req: Http2ServerRequest, resp: Http2ServerResponse, data: object): any

使用实例

const http = require("http")
import { Http2ServerRequest, Http2ServerResponse } from 'http2';
const path = require("path")
let o : string = path.normalize('./router');
import ROUTER from './router';
import { ROUTER_EVENT } from './router/router_event/event';
const routers = new ROUTER();
const testevent = new ROUTER_EVENT()
const testrouter = (url: string, req: Http2ServerRequest, res: Http2ServerResponse) => {
const data: object = {
'msg': (() => {
    return 'success';
})(),
'code': (() => {
    return 200;
})(),
'data': (() => {
    return [{}]
})()
}
routers.router('get', url, '/api/home', req, res, data)
testevent.addListener("api_home", url, { timeout: 1000, callback() { } })
testevent.eventHook("api_home", req, res, { hook_name: 'api_hook', data: data, callback() { } })
}
http.createServer((req: Http2ServerRequest, res: Http2ServerResponse)=>{
let url = routers.pathname(req);
testrouter(url,req,res);
}).listen(80)

如果发现debug

联系邮箱: [email protected]

谢谢🙏您的支持,请多多包涵