This project provides an API to check if a GitHub user has starred the Shardeum repository. It also includes a worker to periodically update the local database with the latest stargazers.
- Check if a user has starred the Shardeum repository
- Periodically update the local database with the latest stargazers
- Express.js API with security middleware (Helmet, CORS)
- SQLite database for storing stargazer information
- Node.js (v14 or higher recommended)
- npm (Node Package Manager)
- Clone the repository:
git clone https://github.com/yourusername/shardeum-stargazer-api.git
cd shardeum-stargazer-api
- Install dependencies:
npm install
- Create a
.env
file in the project root directory. - Add the following environment variables:
PORT=3000
GITHUB_ACCESS_TOKEN=your_github_access_token
Replace your_github_access_token
with a valid GitHub Personal Access Token.
To start the application:
npm start
This command will:
- Set up the SQLite database
- Start the Express.js API server
- Start the worker to update stargazers periodically
-
GET
/check-star/:username
-
GET
/check-star?username=:username
Parameters:
username
: GitHub username to check
Response:
{ "hasStarred": true|false }
- setup_db.js: Sets up the SQLite database and creates necessary tables
- app.js: Express.js API server
- update_stargazers.js: Worker to fetch and update stargazers in the database
- start.js: Script to start all components of the application
- package.json: Project metadata and dependencies
This project is licensed under the MIT License.