GitHub Profile Next.js API with Octokit
This Gist contains a Next.js API route implemented in TypeScript for interacting with the GitHub API using the Octokit library. The primary purpose of this API route is to retrieve information about repositories belonging to a specific GitHub user.
Features:
- Endpoint: The API exposes an endpoint at
/api/reposfor handling HTTP GET requests. - Parameter: Expects a
usernameparameter in the query string to identify the target GitHub user. Example usage:http://localhost:3000/api/repos?username=sametcn99. - Error Handling: Includes robust error handling for scenarios such as missing parameters or failed GitHub API requests.
- GitHub Authentication: Utilizes a GitHub token obtained from environment variables (
process.env.GH_TOKEN) for authentication.