1.0.2 • Published 6 years ago

koot-proxy v1.0.2

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
6 years ago

koot-proxy

koot 框架系列的代理功能。

安装

$ npm install koot-proxy

API

服务器转发Ajax

serverAjaxProxy

在koot框架目录的 /server/router/index.js 文件中添加如下代码

const { serverAjaxProxy } = require('koot-proxy')

router.get('/api/proxy', async (ctx) => {
    ctx.body = await serverAjaxProxy({
        method: 'GET',
        url: ctx.query.url
    })
})

实际Ajax请求接口地址替换为 /api/proxy?url= (注:url需要经过 encodeURIComponent 编码)

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago