summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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! 🚀