···2233vercel edge function that returns some infos of a github account as a json (contributions, repositories, followers, following, issues, prs, status).
4455-can be called from any frontend application, including static sites.
66-75detailed infos:
8697- contributions of the last year total, and split by day
···242225231. create a personal access token on github, go to `settings` -> `developer settings` -> `personal access tokens (classic)` -> `generate new token (classic)`, set expiration date to "No expiration" and add the `public_repo` scope.
26242525+2. if using in browser, set cors options in `github-data.ts:8-10`
2626+2727+```ts
2828+// set your domain here
2929+const corsOptions = {
3030+ origin: ['https://blento.app', 'https://www.blento.app'],
3131+};
3232+```
3333+27342. deploy to vercel
28352936[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fflo-bit%2Fedge-function-github-contribution&env=GITHUB_TOKEN)
···3643// get data of user that owns the token
3744https://<your-deployment-url>/api/github-data
38453939-// get data of a specific user (disabled by default, see below how to enable it)
4646+// get data of a specific user (to disable see below)
4047https://<your-deployment-url>/api/github-data?user=<username>
4148```
4249···515852597. it's recommended to remove data points you don't need, to reduce the size of the response and speed up the request
53605454-8. if you want to allow querying users other than yourself, change line 9 in `api/github-data.ts` to:
6161+8. if you dont want to allow querying users other than yourself, change line 9 in `api/github-data.ts` to:
55625663```ts
5757- const allowUserSelection = true;
6464+ const allowUserSelection = false;
5865```
59666067## development