Skip to Content
Node.js 프로젝트
book

Node.js 프로젝트

by Jonathan Wexler
July 2025
Beginner to intermediate
372 pages
5h 25m
Korean
O'Reilly Media, Inc.
Content preview from Node.js 프로젝트

6장. 라이브러리 API

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

이 장에서는 다음 내용을 다룹니다:

  • Fastify.js로 API 구축하기

  • REST 엔드포인트 구축하기

  • 관계형 데이터베이스에 연결하기

대부분의 사람들은 웹 브라우저를 통해 인터넷에 익숙하지만, 대부분의 활동과 데이터 전송은 백그라운드에서 이루어집니다. 실시간 기차 시간표와 같은 일부 데이터는 독립형 웹 앱이 아닌 다른 사람들이 자신의 앱에서 사용하고 구현할 수 있는 리소스로 제공됩니다. 이러한 리소스를 API(애플리케이션 프로그래밍 인터페이스)라고 하며, 사용자는 철도 당국과 같이 제한된 환경에 속하는 전체 또는 일부 데이터를 볼 수 있습니다. 일부 API는 데이터를 추가, 수정 및 삭제할 수 있으며, 특히 자신의 데이터이거나 해당 리소스 자체에 대한 권한이 있는 경우 더욱 그렇습니다.

이 장에서는 표준 프로토콜을 통해 데이터에 대한 액세스 및 수정을 지원하는 RESTful API를 구축합니다. 또한 API를 데이터베이스에연결하여 새 정보를 추가하고 이전 레코드에 액세스할 수 있습니다. 결국 거의 모든 유형의 데이터에 대한 API를 구축하는 데 필요한 번역 가능한 기술을 갖추게 됩니다.

귀하의 프롬프트

마을에서 공공 도서관을 현대화할 수 있는 개인에게 보조금을 지급하고 있습니다. 가장 우선순위에 있는 것은 도서관에서 아직 제공되지 않거나 공급이 부족한 도서를 대중이 요청할 수 있는 시스템을 구축하는 것입니다. 모바일 및 웹 클라이언트를 설계하는 그룹에는 이미 보조금이 지급되었지만 백엔드 API를 구축할 사람이 아직 필요합니다. Node와 Fastify에 어느 정도 익숙하고 도전하기로 결정했습니다.

계획 세우기

이 프로젝트의 목표는 모바일 및 웹 앱이 북 레코드를 보고, 추가하고, 업데이트하거나 삭제하기 위해 연결할 수 있는 API를 구축하는 것입니다. 웹사이트의 URL과 마찬가지로 다른 클라이언트에서 액세스할 수 있는 엔드포인트(URI)를 제공하는 API를 만들게 됩니다. 먼저 Fastify 프레임워크로 노드 앱을 만들고 라이브러리 데이터와의 상호 작용을 지원하고 해당 데이터를 데이터베이스에 유지하는 부분을 점차적으로 추가합니다. 그림 6-1에 표시된 대로 프로젝트의 설계 요구 사항을 따릅니다.

참고

유니폼 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Node.js: Novice to Ninja

Node.js: Novice to Ninja

Craig Buckler
NGINX 쿡북(3판)

NGINX 쿡북(3판)

데릭 디용기
Docker: Up & Running, 제3판

Docker: Up & Running, 제3판

Sean P. Kane, Karl Matthias

Publisher Resources

ISBN: 9798341665675