Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork90
License
CodeYourFuture/dom-ajax-repo
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
- Fork and Clone this repo
- Run
npm installthennpm start(don't worry if you don't understand these commands now, we will explain them in Node module) - When you run
npm 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 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/
- Try to open this URI on the browserhttps://api.github.com/users/codeyourfuture/repos. What do you get back? Try changingcodeyourfuture to your Github username, and see if you get back your list of repositories.
Now to the requirements.
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
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.
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 page
my-github.html. Inside this file there are references to the scriptmy-github.jsand the CSS filemy-github.css. These are the files that you will need to change for Part 1 tasks.
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 the
htmlandJavaScripttogether. Go to thehtmlpage and add a script tag<script src="../js/pull-requests.js"></script>
Where do I write the code for Part 2 requirements?
The file
pull-requests.js(that you just linked) is where you need to write the JavaScript to peform these requirements.
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)
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.
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
Hint: This code below listens to
keyupevent (The keyup event is fired when a key is released) and gets the last value fromeventparameter
// 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).
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 in
my-github.jsto finish this final task.
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 in
my-github.jsto finish these tasks.
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
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Languages
- HTML70.2%
- CSS17.2%
- JavaScript12.6%


