Coder Social home page Coder Social logo

stargazers-api's Introduction

Shardeum Stargazer API

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.

Table of Contents

Features

  • 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

Prerequisites

  • Node.js (v14 or higher recommended)
  • npm (Node Package Manager)

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/shardeum-stargazer-api.git
cd shardeum-stargazer-api
  1. Install dependencies:
npm install

Configuration

  1. Create a .env file in the project root directory.
  2. 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.

Usage

To start the application:

npm start

This command will:

  1. Set up the SQLite database
  2. Start the Express.js API server
  3. Start the worker to update stargazers periodically

API Endpoints

Check if a user has starred

  • GET /check-star/:username

  • GET /check-star?username=:username

    Parameters:

    • username: GitHub username to check

    Response:

    {
      "hasStarred": true|false
    }

Project Structure

  • 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

License

This project is licensed under the MIT License.

stargazers-api's People

Contributors

kenny-io avatar

Watchers

Nischal Shetty avatar Mehdi Sabraoui avatar Marc Hanson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.