Closed Dave93 closed 9 years ago
You'll need to use a promise friendly version of request
, such as request-promise.
Your code would look something like:
var request = require('request-promise');
exports.getIndex = function(db) {
return request({
uri: "https://api.backendless.com/v1/data/ib_companies?where=index_slider%3Dtrue", //o`
method: "GET",
headers: global.BackendlessApp
}).then(function (body) {
return JSON.parse(body);
});
};
Good evening Jon Abrams. I have one task. I have to make http request in back-end to the api of backendless.com with "request" package of nodejs. I do such action, because front-end user shouldn't see api keys of backendless from any js file. When i print recieved data to node console i see data, but when i return this data to front-end i don't see anything printing it to console. Could you help with this issue? Back-end code:
Front-end code: