✅CDN이란 ?
Content Delivery Network의 줄임말이며 지리적으로 분산된 여러 개의 서버이다. 이는 웹 콘텐츠를 사용자와 가까운 곳에서 전송함으로써 전송 속도를 높인다. CDN은 웹 페이지, 이미지, 비디오 등의 콘텐츠를 사용자의 물리적 위치와 가까운 서버에 복제해둔다. 이렇게 하면 콘텐츠가 로딩될 때까지 기다릴 필요 없이 영화 감상, 소프트웨어 다운로드, 은행 잔고 확인, 소셜 미디어 포스팅, 구매 등의 작업을 할 수 있다.
➰CDN 사용법
원하는 기능을 검색하면 다양한 웹사이트에서 CDN링크를 제공한다. 아래의 사이트들이 이에 해당된다.
cdnjs - The #1 free and open source CDN built to make life easier for developers
Simple. Fast. Reliable. Content delivery at its finest. cdnjs is a free and open-source CDN service trusted by over 12.5% of all websites, serving over 200 billion requests each month, powered by Cloudflare. We make it faster and easier to load library fil
cdnjs.com
npm
Bring the best of open source to you, your team, and your company Relied upon by more than 11 million developers worldwide, npm is committed to making JavaScript development elegant, productive, and safe. The free npm Registry has become the center of Java
www.npmjs.com
사이트에서 CDN의 링크를 복사한 후 html 파일의 head태그 부분에 script 태그를 이용하여 링크를 붙여 넣어주면 사용할 수 있다. 코드 예시는 다음과 같다.
<head>
<script src="(링크)"></script>
</head>
'WEB > JS' 카테고리의 다른 글
[JS] 15-1. 챗봇 유동적인 기능 만들기 (json parsing) (0) | 2021.10.02 |
---|---|
[JS] 14-2. 과제 - CDN 사용법 (2) | 2021.10.01 |
[JS] 13. 과제 - 챗봇 만들기 3일차 (태그 제어 → 값 변경 및 버튼 이벤트 생성) (2) | 2021.09.29 |
[JS] 12. 과제 - 챗봇 만들기 2일차(태그 제어 → 배경색 변경) (0) | 2021.09.29 |
[JS] 11. 과제 - 챗봇 만들기 1일차(조건문 → 값 전달) (0) | 2021.09.29 |