node-profetch
v0.0.1-alpha.0
Published
An Express/Koa middleware which proxies HTTP request intelligently
Downloads
11
Readme
node-profetch
An Express/Koa middleware which proxies HTTP request intelligently.
Install
yarn add node-profetch
This package works best with profetch
Usage
Use it with Express
const express = require('express')
const profetch = require('node-profetch/express')
const app = express()
app.use(express.json()) // the mime type requires application/json
app.use('/api', profetch())
app.listen(3000)
Use it with Koa
const Koa = require('koa')
const Router = require('koa-router')
const bodyParser = require('koa-bodyparser')
const profetch = require('node-profetch/koa')
const app = new Koa()
const router = new Router()
router.post('/api/*', profetch())
app.use(bodyParser()) // the mime type requires application/json
app.use(router.routes())
app.use(router.allowedMethods())
app.listen(3000)
Options
alias
Map for url alias which is used for hidden and restriction.
onHttp
Subscribe infomation of http request in backend.
Contributing
Welcome to contributing, the guidelines are being drafted.
License
Licensed under the MIT license.