how to make a web request

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to make a web request

boris.reitman
Hello,

I'm trying to write my first program in Lively. I want to request some REST api, for example this one:


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
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
Reply | Threaded
Open this post in threaded view
|

Re: how to make a web request

Robert Krahn-4
1) This world shows a simple example of how to make a request:


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 <[hidden email]> wrote:
Hello,

I'm trying to write my first program in Lively. I want to request some REST api, for example this one:


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
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel



_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel