javascript - How I can transform the result of node.js to prevent ember.js error: No model was found for '0 '? -
node.js returns (results):
[ { "value1": "234", "id": 67, "value2": "76543" }, { "value1": "468", "id": 68, "value2": "98765" }, {..} ]
but ember.js needs
{ "data":[ { "value1": "234", "id": 67, "value2": "76543" }, { "value1": "468", "id": 68, "value2": "98765" }, {..} ] }
and cannot find correct way modify node.js return function:
if err console.log "error: #{err.message}" throw err res.send results
so think need "wrap" results of query... ideas?
oh, im using express if helps...
just use
res.send {data: results}
Comments
Post a Comment