Skip to content

Commit b98544a

Browse files
committed
Update README and API files: improve documentation, remove unused cache refresh endpoint, and add GitHub link
1 parent c59b7e0 commit b98544a

File tree

3 files changed

+39
-24
lines changed

3 files changed

+39
-24
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44
*"Yet Another LeetCode API" - Because why reinvent the wheel? (But we did anyway 🛠️)*
55

66
## 🚀 Core Services
7+
78
- **Live Demo**: [leetcode-api-pied.vercel.app](https://leetcode-api-pied.vercel.app)
8-
- **Interactive Docs**: [docs.leetcode-api.vercel.app](https://leetcode-api-pied.vercel.app/docs)
9-
- **Google Sheet Integration**: [View Sheet](https://docs.google.com/spreadsheets/d/1sRWp95wqo3a7lLBbtNd_3KkTyGjx_9sctTOL5JOb6pA/edit?usp=sharing)
9+
- **Interactive Docs**: [leetcode-api-pied.vercel.app/docs](https://leetcode-api-pied.vercel.app/docs)
10+
- **Google Sheet**: [View Sheet](https://docs.google.com/spreadsheets/d/1sRWp95wqo3a7lLBbtNd_3KkTyGjx_9sctTOL5JOb6pA/edit?usp=sharing)
1011
*(Daily updated LeetCode question database with sorting/filtering)*
1112

12-
A no-nonsense LeetCode API service for developers who want LeetCode data without the scraping headaches. Perfect for:
13-
- Building coding portfolios 🖼️
14-
- Tracking practice stats 📊
15-
- Creating LeetCode-powered apps 💻
16-
- Just messing around with API endpoints 🤹
13+
**Enable Filtering/Sorting:**
14+
1. Select **Row 3**.
15+
2. Go to **Data > Filter views > Create new filter view**.
1716

1817
## ⚡ Quick Start
1918

2019
```bash
2120
# Get today's daily challenge
2221
curl https://leetcode-api-pied.vercel.app/daily
2322

24-
# Find a question by ID/slug
23+
# Find a problem by ID/slug
24+
curl https://leetcode-api-pied.vercel.app/problem/1
2525
curl https://leetcode-api-pied.vercel.app/problem/two-sum
2626

2727
# Get user profile (try your LeetCode username!)
@@ -33,7 +33,7 @@ curl https://leetcode-api-pied.vercel.app/user/lee215
3333
| Endpoint | Method | Description | Example |
3434
|---------------------------------|--------|-------------------------------------|---------------------------------------------------------------------------------------------|
3535
| `/problems` | GET | All LeetCode problems | [/problems](https://leetcode-api-pied.vercel.app/problems) |
36-
| `/problem/{id_or_slug}` | GET | Get problem by ID/slug | [/problem/two-sum](https://leetcode-api-pied.vercel.app/problem/two-sum) |
36+
| `/problem/{id_or_slug}` | GET | Get problem by ID/slug | [/problem/1](https://leetcode-api-pied.vercel.app/problem/1)<br />[/problem/two-sum](https://leetcode-api-pied.vercel.app/problem/two-sum) |
3737
| `/search/{query}` | GET | Search for problems | [/search?query=two%20sum](https://leetcode-api-pied.vercel.app/search?query=two%20sum) |
3838
| `/random` | GET | Random LeetCode problem | [/random](https://leetcode-api-pied.vercel.app/random) |
3939
| `/user/{username}` | GET | User profile & stats | [/user/lee215](https://leetcode-api-pied.vercel.app/user/lee215) |
@@ -79,16 +79,16 @@ or download `leetcode_questions.json`(updated daily) directly from the `data` f
7979

8080
## 🤔 Why This API?
8181
- Always Fresh Data 🥬
82-
Auto-updating cache system (no stale LeetCode questions!)
82+
Auto-updating cache system (no stale LeetCode questions!)
8383

8484
- Vercel-Ready ⚡
85-
One-click deployment with serverless architecture
85+
One-click deployment with serverless architecture
8686

8787
- No API Keys 🔓
88-
Free to use with sensible rate limits
88+
Free to use with sensible rate limits
8989

9090
- Real LeetCode Data 🔥
91-
Direct integration with LeetCode's GraphQL API
91+
Direct integration with LeetCode's GraphQL API
9292
9393
---
9494

src/api/api.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -342,14 +342,6 @@ async def get_daily_challenge():
342342
async def health_check():
343343
return {"status": "ok", "timestamp": time.time()}
344344

345-
@app.get("/refresh", tags=["Admin"])
346-
async def refresh_cache():
347-
# Force refresh the question cache regardless of the update interval
348-
async with cache.lock:
349-
await cache._fetch_all_questions()
350-
cache.last_updated = time.time()
351-
return {"detail": "Cache refreshed"}
352-
353345

354346
@app.get("/", response_class=HTMLResponse, include_in_schema=False)
355347
async def home():

src/api/home.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,32 @@
5151
<body class="bg-gray-100 min-h-screen flex items-center justify-center">
5252
<div class="max-w-2xl mx-4 text-center">
5353
<div class="bg-white rounded-lg shadow-lg p-8 space-y-6">
54-
<div class="flex justify-end">
55-
<button id="theme-toggle" class="text-gray-500 hover:text-gray-700 dark:text-gray-300 dark:hover:text-gray-100 focus:outline-none">
56-
<i id="theme-icon" class="fas fa-moon"></i>
54+
<div class="flex justify-end space-x-2">
55+
<!-- GitHub Icon Button -->
56+
<a href="https://github.com/noworneverev/leetcode-api"
57+
target="_blank"
58+
class="flex items-center justify-center w-10 h-10
59+
rounded-full
60+
bg-gray-100 dark:bg-gray-700
61+
text-gray-600 dark:text-gray-300
62+
hover:bg-gray-200 dark:hover:bg-gray-600
63+
hover:text-gray-800 dark:hover:text-gray-100
64+
transition-colors duration-200
65+
focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
66+
<i class="fab fa-github fa-lg"></i>
67+
</a>
68+
69+
<!-- Theme Toggle Icon Button -->
70+
<button id="theme-toggle"
71+
class="flex items-center justify-center w-10 h-10
72+
rounded-full
73+
bg-gray-100 dark:bg-gray-700
74+
text-gray-600 dark:text-gray-300
75+
hover:bg-gray-200 dark:hover:bg-gray-600
76+
hover:text-gray-800 dark:hover:text-gray-100
77+
transition-colors duration-200
78+
focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
79+
<i id="theme-icon" class="fas fa-moon fa-lg"></i>
5780
</button>
5881
</div>
5982
<h1 class="text-4xl font-bold text-gray-800 mb-4">

0 commit comments

Comments
 (0)