posting to an external db

3 views
Skip to first unread message

Phil Au

unread,
Mar 17, 2015, 12:17:11 AM3/17/15
to socket...@googlegroups.com
Hi I m new to SocketStream

I've been reading the documentation and I was following the part about using an external db api in the main app.js file;

  1. // in /app.js
  2. var db = require('mydb'),
  3. conn = db.createClient();
  4.  
  5. ss.api.add('db', conn);

I followed this example trying it out with an external redis db server but when I tested it in the server/rpc/example.js file, my program does not recognise ss.db.

I wrote this function in server/rpc/example.js

 ss.db.set("User", user); 

My program then crashes giveing an error of undefined.

It seems my program is not recognising ss.db entirely. I know this because I tested with console.log(ss.db); What may I have been doing wrong?


Reply all
Reply to author
Forward
0 new messages