Skip to content

[FEAT] Route Handler 기반 API 레이어 분리 #35

Description

@dev-oil

기능 요약

공공 API 직접 호출 → Next.js Route Handler로 이전 (API 키 보호, CORS 해결)

작업 목록

Route Handler 구성

  • app/api/animals/route.ts 생성
  • app/api/animals/[id]/route.ts 생성
  • app/api/species/route.ts 생성
  • API 키 환경변수 서버 사이드로 이동 (NEXT_PUBLIC_ 제거)
  • 응답 캐싱 설정 (revalidate: 3600)
  • 에러 응답 포맷 통일 ({ error, status })

클라이언트 교체

  • shelterAPI.ts 서버 사이드 fetch로 재작성
  • 기존 공공 API 직접 호출 코드 제거
  • /api/* 호출로 전환 및 동작 확인

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions