https://github.com/barandev/search-code-using-github-api
The GitHub Code Search App is a Flask-based web application that enables users to search for code snippets on GitHub. Powered by the GitHub API, this lightweight tool provides a seamless interface for developers to discover code repositories efficiently.
https://github.com/barandev/search-code-using-github-api
codesearch data-retrieval flask github-integration githubapi html-css javascript open-source restful-api webdevelopment
Last synced: 5 months ago
JSON representation
The GitHub Code Search App is a Flask-based web application that enables users to search for code snippets on GitHub. Powered by the GitHub API, this lightweight tool provides a seamless interface for developers to discover code repositories efficiently.
- Host: GitHub
- URL: https://github.com/barandev/search-code-using-github-api
- Owner: BaranDev
- License: mit
- Created: 2024-02-26T23:59:10.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-04T09:15:20.000Z (over 1 year ago)
- Last Synced: 2025-03-17T19:19:55.647Z (10 months ago)
- Topics: codesearch, data-retrieval, flask, github-integration, githubapi, html-css, javascript, open-source, restful-api, webdevelopment
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Code Search App
This repository contains code for a simple web application that allows users to search for code snippets on GitHub using the GitHub API.
## Usage
1. Clone or download the repository.
2. Set up a virtual environment (optional but recommended).
3. Install dependencies using `pip install -r requirements.txt`.
4. Obtain a GitHub personal access token with the `repo` scope.
5. Set the GitHub token as an environment variable named `GITHUB_TOKEN`.
6. Run the Flask app using `python main.py`.
7. Open the web browser and navigate to `http://localhost:8080`.
8. Enter your search query in the provided input field and submit the form.
## Files
### main.py
This file contains the main application logic implemented using Flask. It includes routes for rendering the search page (`/`) and handling search queries (`/search`). It also provides an endpoint to fetch the GitHub token for client-side authorization (`/get-github-token`).
### script.js
This JavaScript file handles the client-side functionality of the application. It makes use of the GitHub token obtained from the server to authenticate requests to the GitHub API. The script fetches search results asynchronously and displays them in a table format on the web page.
## Customization
You can customize the application by:
- Modifying the HTML and CSS templates in the `templates` directory to change the appearance of the search page.
- Adding additional functionality such as pagination or filtering options to enhance the user experience.
- Implementing error handling and refining the UI to provide better feedback to users.
## GitHub Token
To obtain a GitHub personal access token:
1. Go to your GitHub account settings.
2. Navigate to the "Developer settings" section.
3. Click on "Personal access tokens" and generate a new token with the `repo` scope.
4. Copy the generated token and set it as the value of the `GITHUB_TOKEN` environment variable.
## Shields


[](https://github.com/barandev/Search-Code-using-Github-API/blob/main/LICENSE)
[](https://github.com/barandev/Search-Code-using-Github-API/issues)
[](https://github.com/barandev/Search-Code-using-Github-API/pulls)
[](https://github.com/barandev/Search-Code-using-Github-API/stargazers)
[](https://github.com/barandev/Search-Code-using-Github-API/network)
### Created With [Lazy.AI](https://www.getlazy.ai)