본문 바로가기

Web

[Web] Web API

728x90
반응형

API (Application Programming Interfaces)

 

API (Application Programming Interfaces)는

어려운 코드로 되어있는 복잡한 기능을

쉽게 사용할 수 있도록

간단한 구문의 프로그래밍 언어로 제공하는 것이다.

 

예를 들어

자판기에서 제공하는 동전 투입구에 동전을 넣고

버튼을 누르면 자판기의 구조나 원리를 알지 않아도

원하는 음료를 먹을 수 있다.

 

집에서 어떤 기계를 사용하기 위해

콘센트에 전원코드를 연결하면 기계가 작동한다.

전력 공급 장치의 원리나 구조를 알지 않아도

콘센트에 전원코드만 연결하면 된다.

 

브라우저에서 우리가 사용할 수 있는 API를 제공하고

우리는 그 API를 호출하면서 브라우저에 있는 다양한 기능들을 쓸 수 있다.

이러한 API는 JavaScript를 사용하여 접근할 수 있다.

 

JavaScript로 브라우저 위에서 동작하는 것을 만들 때

Window object나 DOM과 BOM에 관련된 API를 쓸 수 있다.

 

브라우저 console창에서 window라는 object를 출력해보자.

 

console.log(window)

 

window안에 들어있는 API인 다양한 function과 object를 볼 수 있다.

alert, document, fetch, prompt, resize, setTimeout, setInterval 등...

프런트엔드 개발에 많이 쓰이는 web API도 들어있다.

 

 

자세한 내용 확인

 

MDN Web API

developer.mozilla.org/en-US/docs/Web/API

 

Web APIs | MDN

When writing code for the Web, there are a large number of Web APIs available. Below is a list of all the APIs and interfaces (object types) that you may be able to use while developing your Web app or site. Web APIs are typically used with JavaScript, alt

developer.mozilla.org

 

MDN Web API : Windows

developer.mozilla.org/en-US/docs/Web/API/Window

 

Window - Web APIs | MDN

The Window interface represents a window containing a DOM document; the document property points to the DOM document loaded in that window. A window for a given document can be obtained using the document.defaultView property. A global variable, window, re

developer.mozilla.org

 

 

 

 

728x90
반응형