whoops, typo on the first line, should be
require('lazorse').connect(), more details on the available
constructors in the docs.

-Stephen

On Apr 12, 10:35 am, Stephen Sugden <[email protected]> wrote:
> Lazorse (http://github.com/BetSmartMedia/Lazorse) is also close to
> doing what you want (disclaimer, I wrote it). It's missing a solid in-
> browser client, but the existing node client could be adapted to use
> jQuery instead of nodes http module without a lot of fuss.
>
> Your example would become something like:
>
> // server.js
> app = require('lazorse')
> app.before(app.findResource, 'bodyParser')
> app.resource('/hello', {
>   shortName: 'hello',
>   POST: function() {
>      this.ok('Hello ' + this.body.name)
>   }
>
> })
>
> // client.js
>
> $('#button').click(function(){
>   var data = { world: 'world' }
>   restClient.postHello({body: data}, function (res) {
>     console.log(res)
>   })
>
> })
>
> It uses callbacks instead of EventEmitters, I'm curious why you'd
> prefer the EventEmitter interface.
>
> -Stephen
>
> On Apr 11, 7:58 am, Alan Hoffmeister <[email protected]>
> wrote:
>
>
>
>
>
>
>
> > I was thinking about something like this on the server side:
>
> > rest-module.on('hello', function(req, res, data){
> >     res.send('Hello ' + data.world);
>
> > });
>
> > And on the client side:
>
> > $('#button').click(function(){
> >     var data = { world : 'world' };
> >     rest-module.emit('hello', data, function(res){
> >         console.log(res);
> >     });
>
> > });
>
> > Is there anything like that already? Tried node-restify, but that's not
> > quite simple as I wished.
>
> > Thank's!
>
> > --
> > --
> > Att,
> > Alan Hoffmeister

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to