We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ebab09d commit bc7ac25Copy full SHA for bc7ac25
api/index.js
@@ -23,9 +23,12 @@ module.exports = async (req, res) => {
23
const currentYear = new Date().getFullYear();
24
const years = _.range(2015, currentYear + 1);
25
const stars = await Promise.all(_.map(years, year => fetch(year)));
26
+ const doc = {};
27
+ for (let i = 0; i < year; i++) {
28
+ doc[years[i]] = `${stars[i]}*`;
29
+ }
30
const allStars = stars.reduce((acc, star) => acc + star);
31
+ doc.allStars = `${allStars}*`
32
console.log(allStars);
- res.json({
- allStars: `${allStars}*`,
- });
33
+ res.json(doc);
34
};
0 commit comments