spee.ch/routes/api-routes.js

21 lines
564 B
JavaScript
Raw Normal View History

2017-06-13 20:00:50 +02:00
module.exports = function(app, axios){
// route to return claim list in json
2017-06-13 20:00:50 +02:00
app.get("/api/claim_list/:claim", function(req, res){
var claim = req.params.claim;
// make a call to the daemon
2017-06-13 20:00:50 +02:00
axios.post('http://localhost:5279/lbryapi', { // to do: extrapolate into lbryApi 'claim list' method and call that
method: "claim_list",
params: {
name: claim
}
}
).then(function (response) {
console.log("success");
res.send(response.data);
}).catch(function(error){
console.log(error.data);
res.send(error.data);
})
});
}