[lively-kernel] how to make a web request

Robert Krahn robert.krahn at gmail.com
Tue Oct 15 21:10:58 CEST 2013


1) This world shows a simple example of how to make a request:

http://lively-web.org/documentation/webrequest-example.html

2) Lets say you created a simple subserver "MyServer" with
$world.openSubserverViewer():

module.exports = function(route, app) {
    app.get(route, function(req, res) {
        res.end("MyServer is running!");
    });
}

To make a request to the handler run:

URL.nodejsBase.withFilename("MyServer/").asWebResource().get().content

(in an older version of Lively:
new URL(Config.nodeJSURL + '/MyServer/').asWebResource().get().content)


On Tue, Oct 15, 2013 at 11:36 AM, Boris Reitman <boris.reitman at gmail.com>wrote:

> Hello,
>
> I'm trying to write my first program in Lively. I want to request some
> REST api, for example this one:
>
> https://api.bitfinex.com/v1/ticker/btcusd
>
> And graph it.  I tried using WebQuery morph, but got some error. Is this
> happening because of cross domain limitations ?
>
> How do I connect some server code to Lively, stuff running on my own
> server? Such as a Node.js instance?
>
> Thanks,
> Boris
>
> _______________________________________________
> lively-kernel mailing list
> lively-kernel at hpi.uni-potsdam.de
> http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hpi.uni-potsdam.de/archive/lively-kernel/attachments/20131015/39bb3983/attachment.html>


More information about the lively-kernel mailing list