2017-06-13 20:00:50 +02:00
|
|
|
|
2017-06-14 00:49:58 +02:00
|
|
|
module.exports = function(app, routeHelpers, lbryHelpers, ua, googleAnalyticsId){
|
2017-06-13 20:00:50 +02:00
|
|
|
// route to fetch all free public claims
|
|
|
|
app.get("/:name/all", function(req, res){
|
2017-06-15 00:47:10 +02:00
|
|
|
console.log(">> GET request on /" + req.params.name + "/all");
|
2017-06-13 20:00:50 +02:00
|
|
|
ua(googleAnalyticsId, {https: true}).event("Show Routes", "/name/all", req.params.name + "/all").send();
|
|
|
|
// create promise
|
2017-06-14 02:13:38 +02:00
|
|
|
lbryHelpers.getAllClaims(req.params.name)
|
2017-06-13 20:00:50 +02:00
|
|
|
.then(function(orderedFreePublicClaims){
|
|
|
|
console.log("/:name/all success.");
|
|
|
|
res.status(200).render('allClaims', { claims: orderedFreePublicClaims });
|
|
|
|
return;
|
|
|
|
})
|
|
|
|
.catch(function(error){
|
|
|
|
console.log("/:name/all error:", error);
|
|
|
|
routeHelpers.handleRequestError(error, res);
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|