Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/greghaskins/jsonpea
A tiny JSONP proxy server written in Go
https://github.com/greghaskins/jsonpea
Last synced: 13 days ago
JSON representation
A tiny JSONP proxy server written in Go
- Host: GitHub
- URL: https://github.com/greghaskins/jsonpea
- Owner: greghaskins
- License: mit
- Created: 2015-02-19T01:12:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-03-24T02:16:56.000Z (over 9 years ago)
- Last Synced: 2024-10-19T13:24:49.684Z (25 days ago)
- Language: Go
- Size: 383 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JSONpea
A tiny JSONP proxy server written in Go[![Build Status](https://travis-ci.org/greghaskins/jsonpea.svg)](https://travis-ci.org/greghaskins/jsonpea)
## A JSONP proxy for local development
`jsonpea` is an alternative to [anyorigin.com](http://anyorigin.com/) or [whateverorigin.org](http://www.whateverorigin.org/) for local development. It's a little single-binary proxy server to work around same-origin issues while developing websites. It fetches the content from a given `url` and calls the `callback` function with the result.
### Installation
```
go get github.com/greghaskins/jsonpea
```### Usage
Start up `jsonpea`:
```
$ $GOPATH/bin/jsonpea
Listening on :7070 ...
```Then hit `http://localhost:7070` in another terminal or browser:
```
GET /get?url=http://httpbin.org/get&callback=doSomething HTTP/1.1
Host: localhost:7070```
```
HTTP/1.1 200 OKdoSomething({
"args": {},
"headers": {
"Accept-Encoding": "gzip",
"Host": "httpbin.org",
"User-Agent": "Go 1.1 package http"
},
"origin": "...",
"url": "http://httpbin.org/get"
}
);
```#### Query Parameters for `/get`
- `url` (required): The remote URL to load.
- `callback` (optional): A named JavaScript function to be called with the payload passed as a parameter. If no callback is specified, the raw data is returned as-is.