Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cnocon/express-github-stats-card
A stats card for GitHub activity built for Node + Express applications.
https://github.com/cnocon/express-github-stats-card
express express-js expressjs github github-stats github-stats-card github-user-stats npm
Last synced: 4 days ago
JSON representation
A stats card for GitHub activity built for Node + Express applications.
- Host: GitHub
- URL: https://github.com/cnocon/express-github-stats-card
- Owner: cnocon
- License: mit
- Created: 2020-12-25T19:34:51.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-28T09:42:20.000Z (almost 4 years ago)
- Last Synced: 2024-10-14T08:53:40.304Z (about 1 month ago)
- Topics: express, express-js, expressjs, github, github-stats, github-stats-card, github-user-stats, npm
- Language: JavaScript
- Homepage:
- Size: 185 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Express GitHub Stats Card
[Demo application](https://github.com/cnocon/express-github-stats-card-demo)
Pass in a minimum of your [GitHub access token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) and a [GitHub username](https://docs.github.com/en/free-pro-team@latest/github/setting-up-and-managing-your-github-user-account/remembering-your-github-username-or-email) and get this:
## Installation
```bash
npm install express-github-stats-card
```
## Example using Express:The Card function returns an HTML string you can append anywhere. The first argument is the GitHub username, the second is your GitHub access token, and the third is an optional `Boolean` for whether or not you want to style the card with the included theme. Defaults to `false`.
Below is code for a `server.js` file you can use as a guide for setting up this component in your own Express application. You can also check out the [demo app code](https://github.com/cnocon/express-github-stats-card-demo).
```js
// /server.js (command to run: node server.js)
const express = require('express');
const Card = require('./components/Card').Card;const app = express();
app.get('/', async (req, res) => {
// I used the dotenv npm package with a .env file containing GITHUB_ACCESS_TOKEN.
// THE .env file is in my .gitignore and will not show up here
const statsCard = await Card('cnocon', process.env.GITHUB_ACCESS_TOKEN, true);
res.send(statsCard);
});app.listen(3000, () => {
console.log('Server running on port 3000');
});
```