Skip to content

ravisingh6565/githubAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<<<<<<< HEAD

GitHub Backend

This project is an Express.js backend that proxies GitHub REST & GraphQL APIs for repository management. It supports public and private repositories (via GITHUB_TOKEN), implements many read endpoints, and includes a GraphQL proxy.

Quickstart

  1. Install dependencies:
    npm install
    
  2. Copy .env.example -> .env and set GITHUB_TOKEN if needed.
  3. Run in dev:
    npm run dev
    

API Prefix

cat > README.md << 'EOF'

GitHub Backend

This project is an Express.js backend that proxies GitHub REST & GraphQL APIs for repository management.
It supports public and private repositories (via GITHUB_TOKEN), implements many read endpoints, and includes a GraphQL proxy.


Quickstart

  1. Install dependencies ```bash npm install ```

  2. Set up environment variables

Copy .env.example to .env and set your GitHub token if needed: ```bash cp .env.example .env ```

Example .env: ```env PORT=5000 GITHUB_TOKEN=ghp_your_personal_access_token_here ```

Use a Classic Personal Access Token with repo (read-only) scope for private repos.

  1. Run in development ```bash npm run dev ``` Server will run at: http://localhost:5000

API Prefix

All endpoints are available under /api.


Endpoints

Repository metadata

```http GET /api/repos/:owner/:repo ```

Directory structure (recursive)

```http GET /api/repos/:owner/:repo/git/trees/:branch ```

File contents

```http GET /api/repos/:owner/:repo/contents/* GET /api/repos/:owner/:repo/contents ```

Commits and history

```http GET /api/repos/:owner/:repo/commits GET /api/repos/:owner/:repo/commits/:sha ```

Compare two commits (diff)

```http GET /api/repos/:owner/:repo/compare/:base...:head ```

Branches & tags

```http GET /api/repos/:owner/:repo/branches GET /api/repos/:owner/:repo/tags ```

Releases

```http GET /api/repos/:owner/:repo/releases GET /api/repos/:owner/:repo/releases/latest ```

Contributors & collaborators

```http GET /api/repos/:owner/:repo/contributors GET /api/repos/:owner/:repo/collaborators ```

Issues, PRs, discussions

```http GET /api/repos/:owner/:repo/issues GET /api/repos/:owner/:repo/pulls GET /api/repos/:owner/:repo/discussions ```

Workflows & Actions

```http GET /api/repos/:owner/:repo/actions/workflows GET /api/repos/:owner/:repo/actions/runs ```

Insights & Statistics

```http GET /api/repos/:owner/:repo/stats/traffic GET /api/repos/:owner/:repo/stats/participation GET /api/repos/:owner/:repo/stats/code_frequency ```

Security & Dependency data

```http GET /api/repos/:owner/:repo/dependency-graph/sbom GET /api/repos/:owner/:repo/dependabot/alerts ```

Events & Webhooks

```http GET /api/repos/:owner/:repo/events GET /api/repos/:owner/:repo/hooks ```

README, Wiki & Pages

```http GET /api/repos/:owner/:repo/readme GET /api/repos/:owner/:repo/pages ```

Authenticated data

```http GET /api/repos/:owner/:repo/environments GET /api/repos/:owner/:repo/actions/secrets ```


Notes

  • Private repositories require a token with repo (read-only) scope. Without it, GitHub returns 404 Not Found.
  • All endpoints automatically use your GitHub token if provided in .env.
  • Test endpoints using Postman, cURL, or browser.
  • Error handling is implemented for GitHub API failures.
  • Combine REST and GraphQL for optimal performance.
  • This backend is production-ready, modular, and easily extendable.

EOF

githubAPI

e751ed844bdeeb94ba27c1e64002d1c7029895a6

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published