This project is a Go-based API that interacts with the LeetCode GraphQL API to fetch user profiles, submission statistics, and other related data.
go-leetcode-api/
├── handler/
│ ├── leetcode.go
│ ├── query.go
│ ├── response.go
├── loggger/
│ ├── loggger.go
├── router/
│ ├── router.go
├── tmp/
├── .air.toml
├── .gitignore
├── go.mod
├── go.sum
├── main.go
└── README.md
- Clone the repository:
git clone https://github.com/etharrra/go-leetcode-api.git
cd go-leetcode-api- Install dependencies:
go mod tidy- Run the application:
go run main.go- The API will be available at
http://localhost:3000.
GET /ping: Health check endpoint.GET /api/:username: Fetches the user profile and submission statistics for the specified LeetCode username.
To fetch the profile and submission statistics for a user with the username etharrra, make a GET request to:
http://localhost:3000/api/etharrra
Logs are written to log.log. The loggger package handles the logging functionality.
The project uses Air for live reloading during development. Configuration is provided in the .air.toml file.
If you'd like to contribute to this project, feel free to fork the repository and submit a pull request. Please ensure that your code follows the existing style and includes appropriate tests.
Happy coding! 🚀