mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-08-16 12:05:44 -04:00
server all the actions!
This commit is contained in:
@@ -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: [
|
||||
|
||||
Reference in New Issue
Block a user