로컬로그인시 api접속가능 middleware
This commit is contained in:
@@ -6,11 +6,21 @@ import type { NextRequest } from "next/server";
|
|||||||
|
|
||||||
|
|
||||||
export default auth(async (req) => {
|
export default auth(async (req) => {
|
||||||
|
|
||||||
|
// 경로 추출
|
||||||
|
const { pathname } = req.nextUrl;
|
||||||
|
|
||||||
|
// 로컬 접속 확인 (특정 경로만 우회)
|
||||||
|
const isLocal = req.headers.get('host')?.includes('localhost') ||
|
||||||
|
req.headers.get('host')?.includes('127.0.0.1');
|
||||||
|
|
||||||
|
if (isLocal && pathname.startsWith("/api/contents")) {
|
||||||
|
return NextResponse.next();
|
||||||
|
}
|
||||||
|
|
||||||
// 세션 가져오기
|
// 세션 가져오기
|
||||||
const session = req.auth;
|
const session = req.auth;
|
||||||
|
|
||||||
const { pathname } = req.nextUrl;
|
|
||||||
|
|
||||||
|
|
||||||
if (pathname.startsWith("/admin")) {
|
if (pathname.startsWith("/admin")) {
|
||||||
const email = session?.user?.email;
|
const email = session?.user?.email;
|
||||||
|
|||||||
@@ -90,6 +90,14 @@ model noticeBoard{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 스키마 파싱 결과 로그
|
||||||
|
model SchemaParseLog {
|
||||||
|
id String @id @default(uuid())
|
||||||
|
parseType String
|
||||||
|
loggedAt DateTime @default(now())
|
||||||
|
comment String @db.LongText
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
npx prisma migrate dev --name <migration_name>
|
npx prisma migrate dev --name <migration_name>
|
||||||
@@ -102,3 +110,4 @@ model noticeBoard{
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user