Skip to content

Yordaniss/commit-searcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commit-Searcher

Small project to search commits from your repository.

Example

alt text

How it works

How the data is stored:

After server was loaded data will be stored to Redis database from api endpoint.

There are several steps to:

  • create Schema like this:
const commitSchema = new Schema(Commit, {

	message: { type: 'text' },

	author: { type: 'string' },

	url: { type: 'string' }

})
  • get data from your repository:
const response = octokit.request('GET https://api.github.com/repos/{owner}/{repo}/commits', {

	owner: process.env.GITHUB_OWNER,

	repo: process.env.GITHUB_REPO

});
  • save data to Redis
response.then(function(result) {

	result.data.map((commit) => {

		saveDataToRedis(

			commit.commit.message,

			commit.commit.author.name,

			commit.html_url,

		)

	})

})
  • create index in Redis:
await  commitRepository.createIndex()

How the data is accessed:

Data will be loaded from server via endpoints to frontend. There you can see all commits and search for data.

  1. Get all data (used search() function from Redis repository)
app.get('/commits', async (req, res) => {

	const commits = await commitRepository.search().return.all();

	res.json(commits)

})
  1. Search messages (used search() function from Redis repository with parameters)
app.post('/search', async (req, res) => {
	const commits = await commitRepository.search().where('message').matches(req.body.message).return.all()

	res.json(commits)
})

How to run it locally?

  • Server (Node.js) -> node server.js
  • Frontend (React) -> npm start

Prerequisites

  1. For development was used Docker to run Redis. You can self host Redis or create an account at official website Redis Cloud.
  2. Generate token from your GitHub account
  3. Install Node.js and NPM
  4. Create .env file with variables:
  • REDIS_URL
  • GITHUB_TOKEN
  • GITHUB_OWNER
  • GITHUB_REPO

Local installation

Pull data from repository Github

More Information about Redis Stack

Here some resources to help you quickly get started using Redis Stack. If you still have questions, feel free to ask them in the Redis Discord or on Twitter.

Getting Started

  1. Sign up for a free Redis Cloud account using this link and use the Redis Stack database in the cloud.
  2. Based on the language/framework you want to use, you will find the following client libraries:

The above videos and guides should be enough to get you started in your desired language/framework. From there you can expand and develop your app. Use the resources below to help guide you further:

  1. Developer Hub - The main developer page for Redis, where you can find information on building using Redis with sample projects, guides, and tutorials.
  2. Redis Stack getting started page - Lists all the Redis Stack features. From there you can find relevant docs and tutorials for all the capabilities of Redis Stack.
  3. Redis Rediscover - Provides use-cases for Redis as well as real-world examples and educational material
  4. RedisInsight - Desktop GUI tool - Use this to connect to Redis to visually see the data. It also has a CLI inside it that lets you send Redis CLI commands. It also has a profiler so you can see commands that are run on your Redis instance in real-time
  5. Youtube Videos

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published