mirror of
https://github.com/System-End/site.git
synced 2026-04-19 22:05:11 +00:00
Add onboard project count
This commit is contained in:
parent
0b89afb0b2
commit
a7478ad1b4
1 changed files with 16 additions and 0 deletions
16
pages/api/onboard/project-count.js
Normal file
16
pages/api/onboard/project-count.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
async function onboardProjectCount() {
|
||||
const url = 'https://api.github.com/repos/hackclub/onboard/contents/projects'
|
||||
|
||||
const response = await fetch(url).then(r => r.json())
|
||||
const countedProjects = response.filter(
|
||||
folder =>
|
||||
folder.type === 'dir' && folder.name[0] !== '.' && folder.name[0] !== '!'
|
||||
)
|
||||
return countedProjects.length
|
||||
}
|
||||
|
||||
export default async function handler(req, res) {
|
||||
const count = await onboardProjectCount()
|
||||
|
||||
res.json({ count })
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue