Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 17, 2024. It is now read-only.

License

NotificationsYou must be signed in to change notification settings

CodeYourFuture/dom-ajax-repo

 
 

Repository files navigation

  1. Fork and Clone this repo
  2. Runnpm install thennpm start (don't worry if you don't understand these commands now, we will explain them in Node module)
  3. When you runnpm start, your browser should open the webpage immediately with hot reload enabled (i.e. when you change files, they will automatically be reflected on the page).

Github API

Github provides anAPI that provides a way for developers to retrieve information about inJSON format. We will spend most of our time using thereposendpoint which GETs the repos (repositories) of a specified user.

The documentation for therepos endpoint is available on:https://developer.github.com/v3/repos/

Now to the requirements.

Part 1: My Github Page

Requirement 1: Show my Repos

Given I am on the Resume site
When I click onMy Github link
Then I should be presented with a list of repositories for my Github user

Requirement 2: Add a link to my repo

Given I am on theMy Github page
When I am presented a list of my Repos
Then each repo should have a link to go to the Github page

Hint: If you're unsure about how to create a link from JavaScript, then checkthis StackOverflow post that has the answer.

Requirement 3: Display the number of Repos

Given I am on the Resume site
When I click onMy Github link
Then I should be shown the number of repos in my Github account (in place of theX)

For the above requirements, you need to use the API:

GEThttps://api.github.com/users/*YOUR GITHUB USERNAME*/repos

Where do I write the code for Part 1 requirements?

Under the folderpages there is the HTML pagemy-github.html. Inside this file there are references to the scriptmy-github.js and the CSS filemy-github.css. These are the files that you will need to change for Part 1 tasks.

tasks 1-3 demo

Part 2: Show Pull Requests submitted against js-exercises

The API:GEThttps://api.github.com/repos/codeyourfuture/js-exercises/pulls

For the below 3 tasks, you'll need to work in:pull-requests.html &pull-requests.js

First, you need to link thehtml andJavaScript together. Go to thehtml page and add a script tag<script src="../js/pull-requests.js"></script>

Where do I write the code for Part 2 requirements?

The filepull-requests.js (that you just linked) is where you need to write the JavaScript to peform these requirements.

Requirement 4: Show ALL Pull Requests

Given I am on the Resume site
When I click onPull Requests link
Then I should be shown a list of allPull Requests title as a link
AND the link should take me to the Pull Request on Github (usehtml_url property from the API response)

Requirement 5: Show Only My Pull Requests

Update the code your wrote for the previous requirement to only show your own Pull Requests. Look at theJSON response and think how you canfilter the response.

Requirement 6: Search for my friend's Pull Requests

Add aSearch input on theMy Pull Requests page. This allows the user to enter a Github username, and while they are searching, we shouldfilter the displayed list of Pull Requests to only show that user's Pull Requests.

Given I am on the the Pull Requests page
When I enter agithub user in thesearch box
Then I should be shown a list ofPull Requests title for that User only

task 6 demo

Hint: This code below listens tokeyup event (The keyup event is fired when a key is released) and gets the last value fromevent parameter

// input is a DOM element we already have using "querySelector"input.addEventListener("keyup",function(event){constvalue=event.target.value;console.log(value);// "value" will be the last value of the input field, and will be updated everytime the user types a new letter});

For the above requirements, you need to use the API:

GEThttps://api.github.com/repos/codeyourfuture/js-exercises/pulls

hint: This request lists all the pull requests against js-exercises. How can you show only the ones that related to your Github username (How can youfilter the list).

Part 3: Update My Github Page to show other Github user's repos

Requirement 7: Display someone else's repos in My Github

Update theMy Github page to add aSearch input and aSearch button. This allows the user to enter a Github username, and when they clickSearch then the page should display the Pull Requests for that user.

Given I am onMy Github page
When I enter agithub username in thesearch box
And I click Enter
Then I should be shown a list of the repos for that user

(stretch goal: if the search box is empty then it should default to my User)

You will need to update the code inmy-github.js to finish this final task.

task 7 demo

For the above requirements, you need to use the API:

GEThttps://api.github.com/users/*A GITHUB USERNAME*/repos

Where do I write the code for Part 3 requirements?

You will need to update the code inmy-github.js to finish these tasks.

Bonus Task: Random API

Pick any random API fromhttps://github.com/toddmotto/public-apis (only those that don't require authentication (have Auth No)) and create a page to use the API

Some ideas includeThe jokes API to get random programming jokes, or theOpen Library API to search and retrieve information about Books, orWordnik to get definitions and example sentences for words, or gettinginformation about food and recipes from a variety of APIs etc...

Make sure to select an API that does not require Authentication, read its documentation for use with HTTP and to get the response inJSON.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages

  • HTML70.2%
  • CSS17.2%
  • JavaScript12.6%

[8]ページ先頭

©2009-2025 Movatter.jp