Skip to content

Github API - Kym and I created a program with the Github API ^.^ we used shell and Javascript...

License

Notifications You must be signed in to change notification settings

whmer/api-github

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Github



index.js

hello! here is the source code of script.js

//npm install axios readline
const axios = require('axios');
const readline = require('readline');

// Create an interface for user input
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

// Ask for the GitHub username
rl.question('Enter the GitHub username: ', async (username) => {
    try {
        // Fetch user information
        const userResponse = await axios.get(`https://api.github.com/users/${username}`);
        console.log('User Info:', JSON.stringify(userResponse.data, null, 2));

        // Fetch user's repositories
        const reposResponse = await axios.get(`https://api.github.com/users/${username}/repos`);
        console.log('Repositories:', JSON.stringify(reposResponse.data, null, 2));
    } catch (error) {
        console.error('Error fetching data from GitHub:', error.message);
    } finally {
        // Close the readline interface
        rl.close();
    }
});
               _         _ _   _           _     
    __ _ _ __ (_)   __ _(_) |_| |__  _   _| |__  
   / _` | '_ \| |  / _` | | __| '_ \| | | | '_ \ 
  | (_| | |_) | | | (_| | | |_| | | | |_| | |_) |
   \__,_| .__/|_|  \__, |_|\__|_| |_|\__,_|_.__/ 
        |_|        |___/                         
 

About

Github API - Kym and I created a program with the Github API ^.^ we used shell and Javascript...

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published