Giter VIP home page Giter VIP logo

adwerx_gh_api's Introduction

README

Setup

# Install required gems
bundle install    

# Initialize the database
rails db:setup

In order to be able to communicate with the GitHub API an access token will need to be provided.

print "GITHUB_API_KEY=<your access token>" > .env

Start Rails:

bin/div

The application should now be available at http://localhost:3000.

homepage_empty

Click on the "Refresh Repositories" button to update the repositories from GitHub. This is an asynchronous operation. Check the logs to see how it's going:

10:53:59 web.1  | Started POST "/github_repositories/refresh" for 127.0.0.1 at 2023-03-17 10:53:59 -0500
10:53:59 web.1  | Processing by GithubRepositoriesController#refresh as TURBO_STREAM
10:53:59 web.1  |   Parameters: {"authenticity_token"=>"[FILTERED]"}
10:53:59 web.1  | Completed 202 Accepted in 2ms (ActiveRecord: 0.0ms | Allocations: 1231)
10:53:59 web.1  |
10:53:59 web.1  |
10:54:03 web.1  | Received 100 / 2967 repositories from Github API
10:54:06 web.1  | Received 200 / 2967 repositories from Github API
...

Refresh the page and it should look similar to the following:

homepage_filled

Note that the GitHub search API will return a maximum of 1000 results. See here for more info.

Other Notes

This application uses sqlite for the database. It has been tested against Ruby 3.2.0 and Rails 7.0.4.3.

Given more time I would improve the following:

  • Add tests, especially around the API operations
  • Add the VCR gem (or similar) to test good/bad responses from the API
  • Improve the feedback given to the user about the status of the processing of the GH API responses

adwerx_gh_api's People

Contributors

jchilders avatar

Watchers

 avatar  avatar

adwerx_gh_api's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.