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 });
  }),
);
