Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. JavaScript Course

Lesson 40 of 55 · javascript

Working with APIs

Duration: 20 mins

Working with APIs

Most modern services expose a JSON‑based HTTP API. The fetch library makes consuming these APIs effortless.

import fetch from 'node-fetch'; // for Node, or use the native fetch in browsers

const apiUrl = 'https://api.github.com/repos/javascript/cjavascript';
fetch(apiUrl)
  .then(resp => resp.ok ? resp.json() : Promise.reject(resp.status))
  .then(data => console.log('Stars:', data.stargazers_count))
  .catch(err => console.error('Error:', err));

Authentication (API keys, OAuth) and pagination are common advanced topics you’ll encounter in real‑world integrations.

Previous: Web Scraping with requests and BeautifulSoup – *Removed*Next: AsyncIO Basics – *Removed*