Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

337
Views
API de buscador de usuarios de Github, ¿cómo devolver múltiples usuarios por búsqueda? JS

Hola, estoy usando github api para crear un buscador de usuarios de github. mi pregunta es cómo manipular el enlace api para obtener usuarios que incluyan e.target.value de la barra de búsqueda y no solo el que coincida exactamente.

aquí está mi código

 const [finalData, setFinalData] = useState([]); const handleSearch = async (e) => { try { const URL = `https://api.github.com/users/${e.target.value}? client_id=e25d1dbedde5215999ef&client_secret=ee080580b7c4f19688ccaef6844c3fe88bb811d`; Promise.all([fetch(URL).then((res) => res.json())]).then((data) => { if (data) { setData(data); } }); } catch (err) { console.log(err); } }; const setData = (data) => { data && setFinalData(data); };
 <script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puede utilizar el extremo Buscar usuarios . Hay un parámetro de consulta (q) que le permite usar múltiples criterios de búsqueda documentados aquí

Aquí hay un ejemplo que usa Octokit , pero si aún desea usar fetch, el punto final debe ser https://api.github.com/search/users

Nota : Realmente espero que el secreto del cliente que está exponiendo aquí sea para una aplicación de prueba.

Buscar usuarios de GitHub Ver en Fusebit
 const userSearch = ''; // Specify the search text here const usersResponse = await octokit.rest.search.users({ q: userSearch, per_page:100 }); const { total_count, items } = usersResponse.data; console.log(`Listing ${items.length} users of ${total_count} \n`, items.map(user => user.login));
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!