1

I am trying to add push notification support to a REST server build in Strongloop / Loopback. I have followed the instructions at http://docs.strongloop.com/display/public/LB/Push+notifications, but it fails. It seems to be due to the line that reads var db = require('./data-sources/db'); this doesn't exist in my loopback installation (perhaps it is documentation related to an older version)?

I can get the sample server running, but trying to get it going in my application has eluded me...

Jordan Kasper
  • 13,153
  • 3
  • 36
  • 55
johnmac
  • 166
  • 1
  • 7

1 Answers1

1

The doc is outdated (I'll fix it). That way of getting the data source is based on the old structure of the push example. You will need to get a handle on your data source differently; typically something like

var datasource = app.datasources.db;

See Working with LoopBack objects for more information.

RandM
  • 231
  • 1
  • 3
  • Thanks - appreciate the response. But is seems more complex than just this... I managed to get it working in the end, but to do so I had to: -copy the notification.json, installation.json and application.json files from the example to my common/models directory -add a new datasource into my datasources.json file for "push" (again, copied from the example) - add various lines to my model-config.json file for application, installation, notification and push Perhaps I did this the hard way, but its the only solution I could find. – johnmac Nov 26 '14 at 21:47
  • I would use server-2.0 with loopback 2.x ....it's a new example. I would use that as your starting point. The docs IMHO could use alot more seasoning, but they're probably busy trying to put out a product. Still a beta product I believe. – user798719 May 28 '15 at 16:24