Skip to content

Commit f87cd33

Browse files
author
stackcats
committed
move to api
1 parent 03fe70d commit f87cd33

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

index.js renamed to api/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ async function fetch(year) {
1919
}
2020
}
2121

22-
async function main() {
22+
module.exports = async (req, res) => {
2323
const currentYear = new Date().getFullYear();
2424
const years = _.range(2015, currentYear + 1);
2525
const stars = await Promise.all(_.map(years, year => fetch(year)));
2626
const allStars = stars.reduce((acc, star) => acc + star);
2727
console.log(allStars);
28-
return { allStars };
29-
}
30-
31-
main();
28+
res.json({
29+
allStars,
30+
});
31+
};

0 commit comments

Comments
 (0)