1

I'm more concerned here about dreamfactory.

I know it's all dependent on RESTful request, but at my level of understanding I couldn't find a way to connect the backend services (managed by dreamfactory) to make the connection.

Ma Khal
  • 11
  • 3

2 Answers2

1

If the service to which you wish to connect has a REST API the DreamFactory platform connect to it out of the box.

I'm not sure what you mean by backbone service. Like Backbone JS service?

This is how you can configure it however:

If you created a new remote web service in the the DSP that connects to a message queue or redis instance for example; you would then have a new endpoint on your DSP which you would call to access the queue or cache. Whatever api_name you give your service is the new endpoint name. It is this new endpoint that you call from your application or services.

Or did I not understand your question... ;)

I haven't used the new JavaScript SDK so the above answer is good advice as well.

lucifurious
  • 630
  • 5
  • 11
1

You may be better off using the javascript sdk for this. You can download one that includes your custom services(if you have any) from the admin console. However, I believe the answer to your question lies in the example below. Remember that with DreamFactory you have to pass your API key(app name) as a header or a url param when you make a request. And I believe for cross-domain authenticated services you will need to pass a 'X-DreamFactory-Session' header with your session token.

Make sure you have the right routes.



    // define server targets / endpoints
    var targets = {
      login: ["/rest/session", "post"],
      logout: ["/rest/session", "delete"] 
    };

    // standalone service
    var service = new Backbone.Service({ url: "YOUR_DSP_URL_HERE", targets: targets });

    // extend backbone model
    var User = Backbone.Model.extend(service);

    var user = new User();
    user.login({ username: 'bob', password: 'secret' });

If you can post your backbone service we may be able to give more targeted advice.

  • I initially meant the general term "backend" so I wasn't specifically referring to backbone.js, but either way I was considering implementing backbone.js because frankly it's becoming hard to avoid using it. So thanks for the answer I will examine it further, and that really helped. – Ma Khal Feb 11 '14 at 05:45
  • Backbone is great. The system also works really well with AngularJS. – user3295505 Feb 11 '14 at 05:52