Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

afeld/jsonp

Repository files navigation

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

HTTP proxy that enables cross-domain requests to any JSON API. See https://jsonp.afeld.me for documentation. See the releases page for the client library changelog.

Development

Code is written in a combination of JavaScript and TypeScript. The app is written to be deployed to a CloudFlare Worker using Terraform, but can be run locally by doing the following:

  1. Install NodeJS >= 7.6.0.

  2. Install the dependencies.

    npm install
  3. Run the server.

    npm start

See CONTRIBUTING for more info.

Deployment

  1. Install NodeJS >= 7.6.0 and Terraform.

  2. Install the dependencies.

    npm install
  3. Set up CloudFlare.

    1. Sign up for CloudFlare, and ensure you have a domain pointed there for DNS.
    2. Get a CloudFlare API key.
      1. Visit the API Tokens page.
      2. Click Create Token.
      3. Use template for Edit Cloudflare Workers.
      4. Add permissions for DNS and Zone.
    3. Go into the terraform/ directory.
    cd terraform
    1. Create a terraform/terraform.tfvars file.
    cloudflare_account_id = "..."
    cloudflare_token = "..."
  4. Create a Terraform Cloud account.

  5. Set up Terraform.

    terraform init
  6. Deploy the environment.

    cd ..
    npm run deploy

If you use the client library with your own JSONP deployment, override the proxy URL before calling $.jsonp().

$.jsonp.PROXY = 'https://mydomain.com/proxy/path/';

See also