Skip to content
This repository has been archived by the owner on Jan 2, 2022. It is now read-only.
/ connect Public archive

处理 Nohost 内部请求转发的模块

License

Notifications You must be signed in to change notification settings

nohosts/connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

connect

该项目已经废弃,请用 https://github.com/nohosts/router 代替,router 不仅支持 connect 所有功能,还支持转发到集群等更多的功能

Nohost 内部处理请求转发的模块

安装

npm i --save @nohost/connect

用法

const { getRawHeaders, request, tunnel, upgrade } = require('@nohost/connect');

API

  1. const rawHeaders = getRawHeaders(req|res):还原请求或响应头大小写
  2. const svrRes = await request(req, res, options)
    • options: 可选,目标服务器的 IP(域名)及端口
    • req:请求对象
    • res: 响应对象
    • svrRes: 上游服务响应对象
  3. tunnel(req, options):代理隧道代理
  4. upgrade(req, options):转发 WebSocket 请求

例子

参考:https://github.com/nohosts/router/blob/master/lib/connect.js

About

处理 Nohost 内部请求转发的模块

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published