Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4827

How to access response data from node backend in ember app

$
0
0

@samtes wrote:

My node route sends data to the front end

router.post("/key", function (req, res, next) {
  // do stuff here 

  res.status(201).send({
    key: "some_value_i_need_in_ember_app"
  });
})

My front-end ember

import Ember from 'ember';

export default Ember.Controller.extend({
  actions: {
    generateKey () {
      var credentials = this.getProperties("difficulty", "quantity");

      this.store.createRecord("key", credentials).save().then(record => {
        console.log("success", record);
      }, reason => {
        console.log("error", reason);
      });
    }
  }
});

However, record doesn't give me the "key" the backend sends. How do I access that data????

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles