28 this.get('/documents/:id/transcript', ({transcripts}, request) => { |
28 this.get('/documents/:id/transcript', ({transcripts}, request) => { |
29 let id = decodeURIComponent(request.params.id); |
29 let id = decodeURIComponent(request.params.id); |
30 return transcripts.find(id).transcript; |
30 return transcripts.find(id).transcript; |
31 }); |
31 }); |
32 |
32 |
33 this.get('/languages'); |
33 this.get('/stats/languages', 'languages'); |
34 |
34 |
35 this.get('/geostats'); |
35 this.get('/stats/geostats', 'geostats'); |
36 |
36 |
37 this.get('/themes'); |
37 this.get('/stats/themes', 'themes'); |
38 |
38 |
39 this.get('/discourses'); |
39 this.get('/stats/discourses', 'discourses'); |
40 |
40 |
41 this.get('/lexvo/:ids', ({lexvos}, request) => { |
41 this.get('/resolvers/lexvo/:ids', ({lexvos}, request) => { |
42 var langIds = decodeURIComponent(request.params.ids); |
42 var langIds = decodeURIComponent(request.params.ids); |
43 var resMap = _.reduce(langIds.split(','), function(res, id) { |
43 var resMap = _.reduce(langIds.split(','), function(res, id) { |
44 var fullId = id; |
44 var fullId = id; |
45 if(!_.startsWith(fullId, constants.LEXVO_BASE_URL)) { |
45 if(!_.startsWith(fullId, constants.LEXVO_BASE_URL)) { |
46 fullId = constants.LEXVO_BASE_URL + id; |
46 fullId = constants.LEXVO_BASE_URL + id; |
52 return { |
52 return { |
53 'lexvoids': resMap |
53 'lexvoids': resMap |
54 }; |
54 }; |
55 }); |
55 }); |
56 |
56 |
57 this.get('/bnf/:ids', ({ bnfs }, request) => { |
57 this.get('/resolvers/bnf/:ids', ({ bnfs }, request) => { |
58 var bnfIds = decodeURIComponent(request.params.ids); |
58 var bnfIds = decodeURIComponent(request.params.ids); |
59 var resMap = _.reduce(bnfIds.split(','), function(res, id) { |
59 var resMap = _.reduce(bnfIds.split(','), function(res, id) { |
60 var fullId = id; |
60 var fullId = id; |
61 if(_.startsWith(fullId, constants.BNF_BASE_URL)) { |
61 if(_.startsWith(fullId, constants.BNF_BASE_URL)) { |
62 fullId = fullId.slice(constants.BNF_BASE_URL.length); |
62 fullId = fullId.slice(constants.BNF_BASE_URL.length); |
72 return { |
72 return { |
73 'bnfids': resMap |
73 'bnfids': resMap |
74 }; |
74 }; |
75 }); |
75 }); |
76 |
76 |
77 this.get('/geonames/:ids', ({ geonames }, request) => { |
77 this.get('/resolvers/geonames/:ids', ({ geonames }, request) => { |
78 var geonamesIds = decodeURIComponent(request.params.ids); |
78 var geonamesIds = decodeURIComponent(request.params.ids); |
79 var resMap = _.reduce(geonamesIds.split(','), function(res, id) { |
79 var resMap = _.reduce(geonamesIds.split(','), function(res, id) { |
80 var code = id; |
80 var code = id; |
81 var m = code.match(constants.GEONAMES_BASE_URLS); |
81 var m = code.match(constants.GEONAMES_BASE_URLS); |
82 if(m) { |
82 if(m) { |