[p2pu-dev] Redirection for API calls to an API_SERVER
Jos Flores
josmasflores at gmail.com
Wed May 16 14:47:49 UTC 2012
Hey Dan,
thanks for the feedback. That is a great point but currently the API
is a layer on top of existing functionality so you could have the same
services without going through the API. I think the original intent is
to be able to serve API data without being a burden on the site.
Good point though if at some stage we wanted to use some kind of
backbone-like framework to create lighter views within the site. As
you say, we would have to serve that data from the same origin,
although the API can also provide JSONP so it might be usable this
way?
cheers,
José
On 16 May 2012 15:24, Dan Diebolt <dandiebolt at gmail.com> wrote:
> If you use a different domain or subdomain for the API endpoint you will not
> be able to call some API methods and consume the response from client side
> code because of the same origin policy. Admittedly the API may not currently
> have methods you want to call client side nor is there any way for a end
> user to create client side javascript but if you offer these capabilities in
> the future you don't want to the same origin policy block those efforts.
>
> On Wed, May 16, 2012 at 6:29 AM, Jos Flores <josmasflores at gmail.com> wrote:
>>
>> Hey guys,
>>
>> I have added a setting API_SERVER to be able to redirect calls to the
>> API to a different machine if that setting is != None
>>
>> Could you guys have a look at the commit here:
>>
>> https://github.com/josmas/lernanta/commit/9ad44ffcc501bd8d4f5810e7b6deace95ff2a9a8
>>
>> Regarding a previous comment by Zuzel (not sure you are still around?)
>> here:
>> https://github.com/josmas/lernanta/commit/7f59a769581f2607c883db7dc0e1672fecc80faa#commitcomment-1227108
>>
>> I've decided against 404-ing p2pu.org/api because in that case we
>> could not serve the API and the site under the same domain. API_SERVER
>> is there for flexibility but I think for now we will be serving
>> everything off the same server so we cannot 404 local calls.
>>
>> Could you guys let me know if you are happy with this and I will send
>> a pull request? Any feedback appreciated!
>>
>> cheers,
>> José
>> _______________________________________________
>> p2pu-dev mailing list
>> p2pu-dev at lists.p2pu.org
>> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>
>
>
> _______________________________________________
> p2pu-dev mailing list
> p2pu-dev at lists.p2pu.org
> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>
More information about the p2pu-dev
mailing list