[nodejs] HTTP client lib that works in browser and Node

11 views
Skip to first unread message

John Wright

unread,
May 23, 2010, 12:09:58 PM5/23/10
to nodejs
I am writing some code shared between the browser and Node where they
both need to do some http client calls. I was thinking of checking
whether I was running in a browser and if the JQuery object was
available and using the jquery.get, post, put methods if so. If
running in node, I was hoping to write a Jquery style wrapper around
node's http client lib so my core code wouldn't have to change. Has
anybody done something like this already? Is the idea of using
JQuery style API to make it more palatable to non Node programmers, a
good one or should I use Mikeal's new Request http lib or some other
simple wrapper. Should I stop worrying about it and get it done
because it will probably take 1 hour, ha.

John

--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.

Joe Developer

unread,
May 23, 2010, 12:20:12 PM5/23/10
to nod...@googlegroups.com
On Sun, May 23, 2010 at 11:09 PM, John Wright <mrjjw...@gmail.com> wrote:
I am writing some code shared between the browser and Node where they
both need to do some http client calls.  I was thinking of checking
whether I was running in a browser and if the JQuery object was
available and using the jquery.get, post, put methods if so.  If
running in node, I was hoping to write a Jquery style wrapper around
node's http client lib so my core code wouldn't have to change.  Has
anybody done something like this already?   Is the idea of using
JQuery style API to make it more palatable to non Node programmers, a
good one or should I use Mikeal's new Request http lib or some other
simple wrapper.    Should I stop worrying about it and get it done
because it will probably take 1 hour, ha.


To each their own I suppose :p


John

--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.

John Wright

unread,
May 23, 2010, 12:29:40 PM5/23/10
to nodejs
Oh yes, I forgot about this blog post, thanks Joe D :)

On May 23, 10:20 am, Joe Developer <joe.d.develo...@gmail.com> wrote:
> On Sun, May 23, 2010 at 11:09 PM, John Wright <mrjjwri...@gmail.com> wrote:
> > I am writing some code shared between the browser and Node where they
> > both need to do some http client calls.  I was thinking of checking
> > whether I was running in a browser and if the JQuery object was
> > available and using the jquery.get, post, put methods if so.  If
> > running in node, I was hoping to write a Jquery style wrapper around
> > node's http client lib so my core code wouldn't have to change.  Has
> > anybody done something like this already?   Is the idea of using
> > JQuery style API to make it more palatable to non Node programmers, a
> > good one or should I use Mikeal's new Request http lib or some other
> > simple wrapper.    Should I stop worrying about it and get it done
> > because it will probably take 1 hour, ha.
>
> > Well, its been done for YUI
>
> http://www.yuiblog.com/blog/2010/04/05/running-yui-3-server-side-with...
>
> To each their own I suppose :p
>
> John
>
>
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nodejs" group.
> > To post to this group, send email to nod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nodejs?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/nodejs?hl=en.

Scott González

unread,
May 23, 2010, 12:43:01 PM5/23/10
to nod...@googlegroups.com
Chris Williams wrote a Node module with jQuery's ajax API a while ago. It probably doesn't work with newer versions of Node.

http://github.com/voodootikigod/node-restclient
Reply all
Reply to author
Forward
0 new messages