🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@yqg/node

Package Overview
Dependencies
Maintainers
15
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yqg/node

Node Middleware

latest
npmnpm
Version
1.8.4
Version published
Weekly downloads
6
-57.14%
Maintainers
15
Weekly downloads
 
Created
Source

@yqg/node 包含常用的工具方法及中间件

packages.json 配置了 sideEffects: false,方便 webpack 进行 tree-shaking

middleware

  • health-check 服务健康检查(特定UA直接返回200)
  • history-api-fallback cdn回源返回404,其他返回index.html(适用于spa)
  • spider-guard cdn回源返回404,其他调用next (适用于ssr)
  • i18n 定时拉取多语言
  • report 错误日志解析

utils

  • createServer、startServer 创建、启动服务

未在 index 中 export 的工具方法

  • handleClientError 对clientError加console及日志输出,方便分析
  • io-start 启动socket.io,方便接enum等实时刷新
  • upgrade-disconnect 断开不支持path的socket upgrade
  • generate-response 包装 res.body
  • request 简单的http client,类似 axios

FAQs

Package last updated on 11 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts