Skip to content

Feat/ API 라우터 수정 및 미들웨어 일시적 추가 #138

Merged
Ruthgyeul merged 9 commits intomasterfrom
develop
May 13, 2025
Merged

Feat/ API 라우터 수정 및 미들웨어 일시적 추가 #138
Ruthgyeul merged 9 commits intomasterfrom
develop

Conversation

@Ruthgyeul
Copy link
Member

#️⃣ Related Issue

#102

📝 PR Description

API 라우터 수정 및 미들웨어 일시적 추가

@Ruthgyeul Ruthgyeul requested a review from Copilot May 13, 2025 19:55
@Ruthgyeul Ruthgyeul self-assigned this May 13, 2025
@Ruthgyeul Ruthgyeul added FEAT 새로운 기능 추가 💻 MASTER Master PR 요청 labels May 13, 2025
@Ruthgyeul Ruthgyeul changed the title Update: API 라우터 수정 및 미들웨어 일시적 추가 Feat: API 라우터 수정 및 미들웨어 일시적 추가 May 13, 2025
@Ruthgyeul Ruthgyeul changed the title Feat: API 라우터 수정 및 미들웨어 일시적 추가 Feat/ API 라우터 수정 및 미들웨어 일시적 추가 May 13, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the API router and temporarily adds middleware to improve authentication and rate limiting. Key changes include the addition of a new middleware for protected routes, an implementation of rate limiting, and updated API routes for signin, signout, and refresh operations.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/middleware.ts Adds middleware logic for checking protected routes and token refresh flow.
src/lib/rate-limit.ts Introduces a rate limit function to restrict excessive API requests.
src/hooks/useAuthApi.js Updates the signout API endpoint from logout to signout.
src/app/api/auth/signout/route.ts Implements the signout API route with cookie cleanup.
src/app/api/auth/signin/route.ts Implements signin API route with rate limiting and detailed error responses.
src/app/api/auth/signin/route.js Removes the legacy signin route.
src/app/api/auth/refresh/route.ts Implements the refresh token API route with error handling and cookie setup.
src/app/api/auth/refresh/route.js Removes the legacy refresh route.
.github/workflows/note.md Removes the obsolete note regarding CICD design.
.github/workflows/deploy.yml Updates workflow permissions for contents reading.

@Ruthgyeul Ruthgyeul requested a review from Copilot May 13, 2025 19:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the API router and adds temporary middleware for authentication, while also introducing rate limiting and refactoring authentication endpoints.

  • Introduces a new middleware to protect specified routes and handle token refresh.
  • Implements a new in-memory rate limiter and updates both signin and signout endpoints (with TypeScript versions replacing outdated JavaScript implementations).
  • Adjusts CI/CD configuration by minor changes in workflow files.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/middleware.ts Adds middleware logic for route protection and token refresh.
src/lib/rate-limit.ts Introduces basic in-memory rate limiting functionality.
src/hooks/useAuthApi.js Updates logout endpoint URL for authentication.
src/app/api/auth/signout/route.ts Implements the signout API route with proper cookie handling.
src/app/api/auth/signin/route.ts Adds a new signin API route with rate limiting and error handling.
src/app/api/auth/signin/route.js Removes the old JavaScript implementation in favor of the TS version.
src/app/api/auth/refresh/route.ts Adds a new refresh API route to handle token refresh with cookies.
src/app/api/auth/refresh/route.js Removes the old JavaScript refresh implementation.
.github/workflows/note.md Removes deprecated note file.
.github/workflows/deploy.yml Adds permissions block for the deploy workflow.
Comments suppressed due to low confidence (1)

src/hooks/useAuthApi.js:41

  • [nitpick] Verify that the updated endpoint URL is consistent with your API routing conventions and that ROUTE_API_URL is correctly configured, given it replaces the previous API_AUTH_URL usage.
`${ROUTE_API_URL}/signout`,

@Ruthgyeul Ruthgyeul requested a review from Copilot May 13, 2025 19:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR revises the API routing and authentication flows by updating middleware and authentication endpoints while temporarily adding a new middleware for protected routes. Key changes include:

  • Adding a middleware in src/middleware.ts to protect certain paths and handle token refresh.
  • Introducing a rate-limiting mechanism and updated authentication endpoints in the API routes.
  • Removing legacy route implementations and updating workflow permissions.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/middleware.ts Adds middleware to check protected routes and refresh tokens.
src/lib/rate-limit.ts Implements an in-memory rate limiting helper.
src/hooks/useAuthApi.js Updates logout endpoint URL to match API changes.
src/app/api/auth/signout/route.ts Implements logout endpoint with cookie deletion logic.
src/app/api/auth/signin/route.ts Adds signin endpoint with rate limiting and improved error handling.
src/app/api/auth/signin/route.js Removes the legacy signin route.
src/app/api/auth/refresh/route.ts Implements refresh endpoint with cookie handling using Axios.
src/app/api/auth/refresh/route.js Removes the legacy refresh endpoint implementation.
.github/workflows/note.md Removes outdated note.
.github/workflows/deploy.yml Updates workflow configuration with new permissions.

@Ruthgyeul Ruthgyeul merged commit c9529cf into master May 13, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FEAT 새로운 기능 추가 💻 MASTER Master PR 요청

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants