todolist 추가

This commit is contained in:
koreacomp5
2025-10-09 15:06:45 +09:00
parent 66538d0d64
commit 02ed610045
2 changed files with 27 additions and 2 deletions

21
src/middleware.ts Normal file
View File

@@ -0,0 +1,21 @@
import { NextResponse, NextRequest } from "next/server";
const protectedApi = [
/^\/api\/posts\/[^/]+\/pin$/,
/^\/api\/posts\/[^/]+\/approve$/,
];
export function middleware(req: NextRequest) {
const { pathname } = req.nextUrl;
const needAuth = protectedApi.some((re) => re.test(pathname));
if (!needAuth) return NextResponse.next();
const uid = req.cookies.get("uid")?.value;
if (!uid) return new NextResponse(JSON.stringify({ error: "Unauthorized" }), { status: 401 });
return NextResponse.next();
}
export const config = {
matcher: ["/api/:path*"],
};

View File

@@ -17,7 +17,7 @@
3.2 비밀번호 해시/검증 로직(bcrypt) 적용 o
3.3 세션/쿠키(HttpOnly/SameSite/Secure) 및 토큰 저장 전략 o
3.4 비밀번호 재설정 토큰 발급/검증/만료 o
3.5 보호 라우팅 미들웨어 및 인증 가드
3.5 보호 라우팅 미들웨어 및 인증 가드 o
3.6 로그인 시도 레이트리밋(정책은 보안/정책 참조)
[상태관리/데이터]
@@ -94,4 +94,8 @@
13.2 CI 파이프라인 구성(테스트/빌드/린트)
13.3 배포 설정 및 헬스체크 엔드포인트
13.4 모니터링/알림(Sentry 등) 연동
13.5 백업/복구 전략 수립
13.5 백업/복구 전략 수립
14
배포용 상태 적용