Hi again Julian,
I tried to create some crack-pot code to fetch the download count of one asset (for my case this is fine since each release only has one asset). I don't know how to test it, but let me know what you think!
app.get('/downloads/:user/:repo/:id', async (req, res) => { const { user, repo, id } = req.params; const response = await request(https://api.github.com/repos/${username}/${repo}/releases/assets/${id}) .header(githubHeaders).json(); if (!response.id) return createError(res, response.message); return res.redirect(https://img.shields.io/badge/Created-${moment(response.download_count).fromNow()}-brightgreen${req.originalUrl.slice(req.originalUrl.indexOf('?'))}) });
https://api.github.com/repos/${username}/${repo}/releases/assets/${id}
https://img.shields.io/badge/Created-${moment(response.download_count).fromNow()}-brightgreen${req.originalUrl.slice(req.originalUrl.indexOf('?'))}
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi again Julian,
I tried to create some crack-pot code to fetch the download count of one asset (for my case this is fine since each release only has one asset). I don't know how to test it, but let me know what you think!
app.get('/downloads/:user/:repo/:id', async (req, res) => {
const { user, repo, id } = req.params;
const response = await request(
https://api.github.com/repos/${username}/${repo}/releases/assets/${id}
).header(githubHeaders).json();
if (!response.id) return createError(res, response.message);
return res.redirect(
https://img.shields.io/badge/Created-${moment(response.download_count).fromNow()}-brightgreen${req.originalUrl.slice(req.originalUrl.indexOf('?'))}
)});