server all the actions!

This commit is contained in:
2025-02-08 12:37:41 -05:00
parent fa5edc003f
commit 37375b766f
27 changed files with 689 additions and 707 deletions
+7 -2
View File
@@ -1,10 +1,15 @@
import { NextResponse } from "next/server";
import { prisma } from "../../../lib/helpers/prisma";
import type { SiteStats } from "../../../types";
import type { hits as Hits } from "@prisma/client";
export const revalidate = 900; // 15 mins
export async function GET(): Promise<NextResponse<SiteStats>> {
export async function GET(): Promise<
NextResponse<{
total: Pick<Hits, "hits">;
pages: Hits[];
}>
> {
// fetch all rows from db sorted by most hits
const pages = await prisma.hits.findMany({
orderBy: [