# Show GN: Cloudflare Workers에서 사용 가능한 API Gateway를 소개합니다.

> Clean Markdown view of GeekNews topic #22817. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=22817](https://news.hada.io/topic?id=22817)
- GeekNews Markdown: [https://news.hada.io/topic/22817.md](https://news.hada.io/topic/22817.md)
- Type: show
- Author: [day1swhan](https://news.hada.io/@day1swhan)
- Published: 2025-08-31T19:02:54+09:00
- Updated: 2025-08-31T19:02:54+09:00
- Original source: [github.com/day1swhan](https://github.com/day1swhan/cf-worker-api-gateway)
- Points: 7
- Comments: 8

## Summary

**Cloudflare Workers** 환경에서 **npm 없이** 손쉽게 사용할 수 있는 **Express.js 스타일**의 **API Gateway**가 공개되었습니다. 이 도구는 미들웨어와 에러 핸들러 지원, 그리고 **URL Params, QueryString, Cookie**를 기본적으로 파싱해 별도 처리가 필요 없는 것이 특징입니다. 또한 **waitUntil 기반의 Context API**로 비동기 작업 처리가 가능하며, **R2, KV Store** 등 Cloudflare 리소스 연동도 지원합니다. 무료 플랜의 **CPU time 제한**과 **I/O 작업 처리 방식**에 대한 팁도 함께 제공하여 실무 적용 시 성능 최적화에 도움이 됩니다.

## Topic Body

Cloudflare Workers 같이 npm을 사용하지 못하는 환경에서 "딸깍"으로 사용 가능한 API Gateway를 소개합니다.  
  
Workers를 이용한 API 서버를 운영하던 중 Switch 문으로 요청 처리하다 열받아서 Express.js 스타일의 API Gateway를 만들게 되었습니다.  
  
Express.js를 사용해 보신 분들은 익숙한 미들웨어, 에러 핸들러를 지원하고, 운영 환경에서 자주 필요한 URL Params, QueryString, Cookie를 따로 미들웨어 사용할 필요 없도록 기본적으로 파싱해서 제공합니다.   
  
추가적으로 지원하는 API는 다음과 같습니다.  
  
- Context API: waitUntil 함수를 이용하면 DB PutItem 같은 작업들을 비동기로 처리해서 사용자에게 Blocking 없는 응답을 제공할 수 있습니다.  
  
- Binding API: R2, KV Store 같이 Cloudflare 서비스들을 사용 가능합니다.  
  
추가 팁)  
- Workers 무료 플랜은 CPU time을 10ms로 제한함.  
- 하지만 Fetch 같은 외부 서비스 I/O 작업에 소요되는 시간은 카운팅 하지 않음.  
- CPU intensive 한 작업이 아닌 대부분의 요청들은 1~2ms 면 충분함.

## Comments



### Comment 44241

- Author: day1swhan
- Created: 2025-09-24T16:32:26+09:00
- Points: 1

추가) 내부 작동 원리가 궁금하신 분들은 개발기를 읽어보시는 것을 추천드립니다.  
  
- https://blog.day1swhan.com/articles/cf-worker-api-gateway

### Comment 43190

- Author: baeba
- Created: 2025-09-01T10:41:07+09:00
- Points: 1

우선.. 응원합니다. 화이팅!!!  
  
hono 좋아요..  
저도 hono 써봤는데.. 잘 만들었어요..

### Comment 43220

- Author: day1swhan
- Created: 2025-09-01T17:06:32+09:00
- Points: 1
- Parent comment: 43190
- Depth: 1

감사합니다ㅎㅎ 역시 열받아서 직접 만들기 전에 검색부터 해보는 습관이 중요한 것 같습니다..ㅎㅎ

### Comment 43166

- Author: yeorinhieut
- Created: 2025-08-31T19:45:36+09:00
- Points: 1

전 hono도 편하더라구요  
이것도 흥미롭네요

### Comment 43170

- Author: day1swhan
- Created: 2025-08-31T19:58:31+09:00
- Points: 1
- Parent comment: 43166
- Depth: 1

감사합니다ㅎㅎ

### Comment 43164

- Author: click
- Created: 2025-08-31T19:24:20+09:00
- Points: 1

유사한 프레임워크로 https://hono.dev/ 도 한번 찾아보시는 걸 추천드립니다.  
개발자가 아에 cloudflare 소속이기도 하고요

### Comment 43165

- Author: day1swhan
- Created: 2025-08-31T19:28:02+09:00
- Points: 1
- Parent comment: 43164
- Depth: 1

헉...감사합니다ㅎㅎ

### Comment 43163

- Author: day1swhan
- Created: 2025-08-31T19:21:48+09:00
- Points: 1

기본적인 worker 사용법과 활용 사례입니다.

- https://blog.day1swhan.com/articles/cloudflare-workers-01
