Giter Site home page Giter Site logo

freddy's Introduction

Freddy is a JSON Slasher!

Freddy is a standalone JSONP proxy written in Sinatra. Running Freddy lets you integrate JSON APIs that do not provide their own JSONP facilities in pages running on your own domain. For more information on JSONP or Sinatra follow the lnks at the bottom of this README.

Once you have deployed Freddy on your own server, access it like this:

freddy.mydomain.com?url=<uri-encoded json-returning url>&callback=<name of my callback function>

The response will look like this:

myCallback({'foo' : 'bar'})

Where myCallback is the value you provided for the ‘callback’ param and {‘foo’ : ‘bar’} is the json returned by GETting the url you provided to the ‘url’ param.

If you do not provide both of the paramters or if the url given cannot be accessed, Freddy will return an error response in the following format:

myCallback({'error' : '<description of error>'})

Note: Freddy just straight up GETs the url and spits back the result. So, if the result is an HD rip of Berlin Alexanderplatz, then your server will (un-)happily start pulling that down. Freddy implements a timeout on getting the JSON of 15 seconds. If requesting your JSON takes longer than that, Freddy will return an error message in the format described above.

There is no security. If you run this, anyone who knows about your Freddy URL will be able to access it for their arbitrary use. Deploy with caution.

NB.: This repo comes with some basic scripts for running Freddy under Thin via Rack and for monitoring it with God. If you want to use them, you’ll need to edit some of the values to point at your copies of files. It should be pretty self-explanatory if you’re familiar with Thin and God (if not, see the links below).

JSONP:

en.wikipedia.org/wiki/JSON#JSONP

remysharp.com/2007/10/08/what-is-jsonp/

ajaxian.com/archives/jsonp-json-with-padding

Sinatra:

sinatra.github.com

Thin:

code.macournoyer.com/thin/

God:

github.com/mojombo/god/tree/master

freddy's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

bmizerany

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.