Newer
Older
taehui / taehui-fe / src / app / www / hit / route.ts
@Taehui Taehui on 17 Mar 430 bytes 2024-03-18 오전 12:51
import { getHit, postHit } from "@/app/www/logic/hit";
import logIP from "@/app/www/media/logIP";
import validateMillis from "@/app/www/media/validateMillis";

export const GET = logIP(async () => {
  return Response.json(await getHit());
});

export const POST = logIP(
  validateMillis(async ({ headers }) => {
    await postHit(headers.get("X-Real-IP") as string);
    return new Response(undefined, { status: 201 });
  }),
);