@http-svc/middleware
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-rc.4 • Public • Published

Http Service 基础中间件

使用方式

派生自定义组件

import { HttpSvcMiddleware } from "@http-svc/middleware"

async function customHanlder(ctx, next) {
    ...
    return await next()
}

class HttpSvcCustomMiddleware extends HttpSvcMiddleware {
    name = 'CUSTOM_NAME'
    constructor() {
        super(customHanlder)
    }
}
// 全局注册(参考 http-svc的init文档)
const http = new HttpService([
    new HttpSvcCustomMiddleware(customHanlder)
])

Package Sidebar

Install

npm i @http-svc/middleware

Weekly Downloads

0

Version

1.0.0-rc.4

License

Apache-2.0

Unpacked Size

15.8 kB

Total Files

11

Last publish

Collaborators

  • josper