Bridge & Express.js

34 views
Skip to first unread message

sbarow

unread,
Jul 15, 2012, 1:37:18 PM7/15/12
to bridge...@googlegroups.com
Hey,

Fairly new to node and was wondering how you would use Bridge with a node framework like Express.

In express you do something like this to create the server,

var app = module.exports = express.createServer();

and then 

app.listen(3000, function(){
  console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
});


Any advise, knowledge would be greatly appreciated :-)

Steve Wang

unread,
Jul 15, 2012, 5:52:13 PM7/15/12
to bridge...@googlegroups.com
Bridge is completely isolated from Express in that with Bridge, you
don't explicitly provide a server, but rather publish services via the
Bridge API on your node server (via your private API key), and
retrieve them in the browser (via your public API key). It should just
work, but if you encounter any more issues, feel free to bring them
up.
> --
> You received this message because you are subscribed to the Google Groups
> "Bridge" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/bridge-users/-/c0qElfowJtMJ.
> To post to this group, send email to bridge...@googlegroups.com.
> To unsubscribe from this group, send email to
> bridge-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/bridge-users?hl=en.

sbarow

unread,
Jul 16, 2012, 7:43:12 AM7/16/12
to bridge...@googlegroups.com
Okay, still a little confused though. In my express install it creates a file app.js with all the relevant node stuff. At the bottom it has the 

app.llisten(3000, function(){});

In that same file would I then have 

var Bridge = require('bridge-js');
var bridge = new Bridge({host: 'localhost', port: 8090, apiKey: 'private-key' });
bridge.connect();

 as well? Like I say, still very new to node so a bit unsure on this.

Steve Wang

unread,
Jul 16, 2012, 11:09:38 AM7/16/12
to bridge...@googlegroups.com
That should work fine; just remember to also publish whatever services
you wish to provide.
>> > bridge-users...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/bridge-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Bridge" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/bridge-users/-/sGHlyc4FxOUJ.
>
> To post to this group, send email to bridge...@googlegroups.com.
> To unsubscribe from this group, send email to
> bridge-users...@googlegroups.com.

sbarow

unread,
Jul 16, 2012, 11:12:30 AM7/16/12
to bridge...@googlegroups.com
Awesome, thanks for you help Steve.
>> > bridge-users+unsubscribe@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/bridge-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Bridge" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/bridge-users/-/sGHlyc4FxOUJ.
>
> To post to this group, send email to bridge...@googlegroups.com.
> To unsubscribe from this group, send email to
> bridge-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages