summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorSaumit <justsaumit@protonmail.com>2024-12-09 00:28:33 +0530
committerSaumit <justsaumit@protonmail.com>2024-12-09 00:28:33 +0530
commita1ef0dd3640266f2a6cf4b4fe8e4d63964f5334c (patch)
treed0ec2e930c967dfd496f52fc7f756347a9fc81c9 /README.md
parent1fa2ce89c7c2c7ba933ae3d5a1cea2df5cbf0838 (diff)
Adding README
Diffstat (limited to 'README.md')
-rw-r--r--README.md97
1 files changed, 97 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..75a62bc
--- /dev/null
+++ b/README.md
@@ -0,0 +1,97 @@
+### Commit Counter API
+
+**Commit Counter API** is a simple Go-based service that fetches the number of GitHub commits made by a user in the current year.
+
+---
+
+### Features
+- Fetch commit count for a specified GitHub username.
+- Simple and lightweight API.
+- Proxies requests through Nginx for secure and scalable access.
+
+---
+
+### Prerequisites
+- Go (1.18 or higher)
+- A GitHub personal access token with public repository access.
+- Nginx for proxying requests (optional but recommended).
+
+---
+
+### Setup
+1. **Clone the repository**:
+ ```bash
+ git clone https://github.com/your-repo/commit-counter.git
+ cd commit-counter
+ ```
+
+2. **Set up the environment**:
+ Create a `.env` file with the following content:
+ ```plaintext
+ GITHUB_TOKEN=your_github_personal_access_token
+ PORT=3001
+ ```
+
+3. **Install dependencies**:
+ ```bash
+ go mod tidy
+ ```
+
+4. **Run the application**:
+ ```bash
+ go run main.go
+ ```
+
+---
+
+### Usage
+**API Endpoint**:
+```plaintext
+GET /commit-count?username={github_username}
+```
+
+**Example**:
+```bash
+curl "http://localhost:3001/commit-count?username=justsaumit"
+```
+
+**Response**:
+```json
+{
+ "commit_count": 184
+}
+```
+
+---
+
+### Nginx Configuration
+Proxy requests through Nginx:
+```nginx
+server {
+ listen 80;
+ server_name commit-counter.example.com;
+
+ location / {
+ proxy_pass http://127.0.0.1:3001;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_set_header Host $host;
+ }
+}
+```
+
+Reload Nginx:
+```bash
+sudo nginx -t
+sudo systemctl reload nginx
+```
+
+---
+
+### License
+This project is licensed under the MIT License.
+
+---
+
+Happy coding! 🚀