Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/afeld/jsonp
DEPRECATED - A proxy to help with cross-domain requests
https://github.com/afeld/jsonp
Last synced: about 2 months ago
JSON representation
DEPRECATED - A proxy to help with cross-domain requests
- Host: GitHub
- URL: https://github.com/afeld/jsonp
- Owner: afeld
- License: mit
- Archived: true
- Created: 2012-05-10T09:51:16.000Z (over 12 years ago)
- Default Branch: main
- Last Pushed: 2022-02-08T04:14:43.000Z (almost 3 years ago)
- Last Synced: 2024-04-08T17:10:06.032Z (8 months ago)
- Language: JavaScript
- Homepage: https://jsonp.afeld.me
- Size: 3.04 MB
- Stars: 301
- Watchers: 16
- Forks: 39
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-json - JSONProxy - Simple HTTP proxy that enables cross-domain requests to any JSON API. (Services)
README
***The hosting for jsonp.afeld.me became too expensive to pay out of pocket, so I have decided to shut this down. Glad so many people found it useful over the years!***
---
# JSONProxy [![Tests](https://github.com/afeld/jsonp/actions/workflows/main.yml/badge.svg)](https://github.com/afeld/jsonp/actions/workflows/main.yml)
HTTP proxy that enables cross-domain requests to any JSON API. See https://jsonp.afeld.me for documentation. See the [releases](https://github.com/afeld/jsonp/releases) page for the [client library](client/jsonp.js) changelog.
## Development
Code is written in a combination of JavaScript and TypeScript. The app is written to be deployed to a [CloudFlare Worker](https://developers.cloudflare.com/workers/) using [Terraform](https://www.terraform.io/), but can be run locally by doing the following:
1. Install NodeJS >= 7.6.0.
1. Install the dependencies.```sh
npm install
```1. Run the server.
```sh
npm start
```See [CONTRIBUTING](CONTRIBUTING.md) for more info.
## Deployment
1. Install NodeJS >= 7.6.0 and [Terraform](https://learn.hashicorp.com/terraform/getting-started/install.html).
1. Install the dependencies.```sh
npm install
```1. Set up CloudFlare.
1. [Sign up for CloudFlare](https://www.cloudflare.com/), and ensure you have a domain pointed there for DNS.
1. Get a CloudFlare API key.
1. Visit the [API Tokens](https://dash.cloudflare.com/profile/api-tokens) page.
1. Click `Create Token`.
1. `Use template` for `Edit Cloudflare Workers`.
1. Add permissions for `DNS` and `Zone`.
1. Go into the [`terraform/`](terraform) directory.```sh
cd terraform
```1. Create a `terraform/terraform.tfvars` file.
```hcl
cloudflare_account_id = "..."
cloudflare_token = "..."
```1. [Create a Terraform Cloud account.](https://app.terraform.io/signup)
1. Set up Terraform.```sh
terraform init
```1. Deploy the environment.
```sh
cd ..
npm run deploy
```If you use [the client library](client/jsonp.js) with your own JSONP deployment, override the proxy URL before calling `$.jsonp()`.
```javascript
$.jsonp.PROXY = 'https://mydomain.com/proxy/path/';
```## See also
- https://github.com/jpillora/xdomain
- https://github.com/mapbox/corslite
- http://enable-cors.org