@gauseen/nuxt-proxy
Nuxt.js Proxy Module
参考资料请看 nuxtjs api, nodejs 中间件 http-proxy-middleware api
使用步骤:
- 安装 @gauseen/nuxt-proxy 依赖资源
npm install --save-dev @gauseen/nuxt-proxy
- 添加
@gauseen/nuxt-proxy资源至nuxt.config.js文件的modules对象之下
例如:
// nuxt.config.js
modules: [
// 请求代理配置,解决跨域
'@gauseen/nuxt-proxy',
],
proxyTable: {
'/api': { target: 'http://example.com', ws: false }
},
注:
/api ———————— 每个接口特定标识字段 [String]
target —————— 目标代理服务 [String]
ws —————————— 是否支持 websocket 代理 [Boolean]
Related Packages
nuxt-resource-hints
Nuxt module that adds HTTP header resource hints for resources in your Nuxt App.
7,868
1
Version History
| Version | Released | License |
|---|---|---|
| 1.0.1 | ISC | |
| 1.0.0 | ISC |