xys-web-shk

web项目适配eggjs本地开发的插件。 当页面链接的协议为https或者http 并且 域名为localhost或者IP+端口 形式的请求,将会走 替换 host域名 和 port端口号 的逻辑。

Usage no npm install needed!

<script type="module">
  import xysWebShk from 'https://cdn.skypack.dev/xys-web-shk';
</script>

README

介绍

web项目适配eggjs本地开发的插件。 当页面链接的协议为https或者http 并且 域名为localhost或者IP+端口 形式的请求,将会走 替换 host域名 和 port端口号 的逻辑。

安装

# 一般是开发阶段使用
npm i xys-web-shk -D

快速上手

import xysWebShk from 'xys-web-shk'

/**
 * host: {string}需要替换成的域名
 * port: {string}需要替换成的端口号
 * exclude: {string[]|RegExp[]}不需要替换的接口白名单
 */
xysWebShk({ host: 'dev-internal.xinhulu.com', exclude: ['/user/login', /^CRM/], port: '80' })

贡献代码