-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addition of GFG API and Course Catalog Project
- Loading branch information
1 parent
92aa0ad
commit 88a10ef
Showing
29 changed files
with
22,540 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules | ||
.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# GFG Public API | ||
|
||
GFG Public API is a Node.js application that fetches user data from GeeksforGeeks (GFG) using Puppeteer. This API allows you to retrieve details like user profile, rank, coding scores, solved problems, and more. | ||
Deployment : https://gfg-api-tzvp.onrender.com/ | ||
|
||
## Features | ||
|
||
- Fetch user profile data from GFG. | ||
- Retrieve coding scores, ranks, and solved problems. | ||
- Simple and easy-to-use API. | ||
|
||
## Prerequisites | ||
|
||
- Node.js (>= 14.20.1) | ||
- npm or yarn | ||
|
||
## Getting Started | ||
|
||
### Installation | ||
|
||
1. Clone the repository: | ||
|
||
```sh | ||
git clone https://github.com/Shariq2003/GFG_API.git | ||
``` | ||
|
||
2. Navigate to the project directory: | ||
|
||
```sh | ||
cd GFG_API | ||
``` | ||
|
||
3. Install the dependencies: | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
### Running Locally | ||
|
||
1. Install Puppeteer and its dependencies: | ||
|
||
```sh | ||
npx puppeteer browsers install chrome | ||
``` | ||
|
||
2. Start the server: | ||
|
||
```sh | ||
npm start | ||
``` | ||
|
||
or | ||
|
||
```sh | ||
npm run dev | ||
``` | ||
|
||
4. Open your browser and navigate to `http://localhost:3000/<username>` to fetch the data for a specific GFG user. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const express=require('express'); | ||
const userData = require('./userData'); | ||
|
||
const app = express(); | ||
|
||
app.get('/',(req,res)=>{ | ||
res.send("GFG API Listening || By Shariq"); | ||
}) | ||
|
||
app.get('/:userName', async (req, res) => { | ||
try{ | ||
const userName = req.params.userName; | ||
console.log(userName); | ||
const data = await userData(userName); | ||
console.log(data) | ||
if(!data){ | ||
res.send("User name not found !") | ||
} | ||
else{ | ||
res.send(data); | ||
} | ||
} | ||
catch{ | ||
console.error('Error fetching user data'); | ||
res.status(500).send('Internal Server Error'); | ||
} | ||
// res.send("GFG API Listening || By Shariq"); | ||
}) | ||
|
||
app.listen(3000,()=>{ | ||
console.log("GFG API Listening on PORT 3000"); | ||
}); |
Oops, something went wrong.