-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nav link animation, serverless function test (#5)
- Loading branch information
1 parent
af81109
commit 9f34347
Showing
68 changed files
with
5,238 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,7 @@ yarn-error.log* | |
.vercel | ||
|
||
# Hugo resources folder | ||
resources | ||
resources | ||
|
||
# Env | ||
.env* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Fetches star count, contributor count and top contributors from the Github API | ||
import axios from "axios"; | ||
import parse from "parse-link-header"; | ||
|
||
const options = { | ||
headers: { Authorization: `Bearer ${process.env.GITHUB_ACCESS_TOKEN}` }, | ||
}; | ||
|
||
export default async function handler(request, response) { | ||
try { | ||
// Fetch the data | ||
const [starsData, totalContributorsData, topContributorsData] = | ||
await Promise.all([ | ||
// Stars | ||
axios.get("https://api.github.com/repos/deepset-ai/haystack", options), | ||
|
||
// Total contributors | ||
axios.get( | ||
"https://api.github.com/repos/deepset-ai/haystack/contributors?per_page=1", | ||
options | ||
), | ||
|
||
// Top 10 contributors | ||
axios.get( | ||
"https://api.github.com/repos/deepset-ai/haystack/contributors?per_page=10", | ||
options | ||
), | ||
]); | ||
|
||
const stars = starsData.data.stargazers_count; | ||
const parsed = parse(totalContributorsData.headers.link); // parse link header to get total pages | ||
const contributors = parsed.last.page; | ||
const topContributors = topContributorsData.data.map((contrib) => ({ | ||
name: contrib.login, | ||
image: contrib.avatar_url, | ||
contributions: contrib.contributions, | ||
})); | ||
|
||
return response.status(200).json({ | ||
stars, | ||
contributors, | ||
top_contributors: topContributors, | ||
}); | ||
} catch (e) { | ||
return response.status(500).json({ message: e.message }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
layout: tutorial | ||
title: "{{ replace .Name "-" " " | title }}" | ||
date: {{ dateFormat "2006-01-02" .Date }} | ||
last-update: {{ dateFormat "2006-01-02" .Date }} | ||
draft: true | ||
category: | ||
level: | ||
description: | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
9f34347
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
haystack-home – ./
haystack-home-git-main-deepset-overnice.vercel.app
haystack-home-deepset-overnice.vercel.app
haystack-home.vercel.app