Newer
Older
taehui / taehui-fe / src / app / www / hit / route.ts
@Taehui Taehui on 17 Mar 431 bytes 2024-03-17 오후 11:29
import logIP from "@/app/www/mws/logIP";
import validateMillis from "@/app/www/mws/validateMillis";
import { getHit, postHit } from "@/app/www/systems/hit";

export const GET = logIP(async (req) => {
  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 });
  }),
);