An open API service indexing awesome lists of open source software.

https://github.com/drowzy/pico-proxy


https://github.com/drowzy/pico-proxy

Last synced: about 1 year ago
JSON representation

Awesome Lists containing this project

README

          

# pico-proxy [![NPM version][npm-image]][npm-url]
> Tiny http proxy for interacting with cross-domain APIs without CORS

## Install

```sh
$ npm install -g pico-proxy
```

## Usage

```js
var picoProxy = require('pico-proxy');

var proxy = picoProxy({ target: 'http://api.domain.com' }).listen(3000);

/* All requests to http://127.0.0.1:3000 will be proxied to http://api.domain.com */
```

## CLI

```
$ pico-proxy --help

Usage
$ pico-proxy

Options
--target hostname or ip to the target server, defaults to http://127.0.0.1
--port port to listen to for the proxy server, defaults to 8080
--protocol protocol used when creating the proxy server, defaults to http
--cors if the proxy server should handle CORS requests, defaults to true
--allow-headers overrides for Access-Control-Allow-Headers, defaluts to '*'
--allow-methods overrides for Access-Control-Allow-Methods, defaults to '*'
--allow-request overrides for Access-Control-Allow-request-Methods, defaults to '*'

Examples
$ pico-proxy --port 3333 --protocol http --target http://api.hostname.com
$ pico-proxy --target http://api.hostname.com --allow-headers "Content-type,X-Sessioncookie"
```
[npm-image]: https://badge.fury.io/js/pico-proxy.svg
[npm-url]: https://npmjs.org/package/pico-proxy