mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-06-05 19:15:30 -04:00
5a1636baa3
- Replace Biome with oxlint + oxfmt (OXC toolchain) for linting and formatting - Add .oxlintrc.json and .oxfmtrc.json configuration files - Update VS Code settings and devcontainer to use oxc-vscode extension - Remove contact form, Resend email integration, and related server action/schema - Remove unused UI components (accordion, alert, card, tabs, toggle, etc.)
31 lines
719 B
TypeScript
31 lines
719 B
TypeScript
import { NextResponse } from "next/server";
|
|
|
|
import { getAllViewCounts } from "@/lib/server/views";
|
|
|
|
export const GET = async (): Promise<
|
|
NextResponse<{
|
|
total: {
|
|
hits: number;
|
|
};
|
|
pages: Array<{
|
|
slug: string;
|
|
hits: number;
|
|
}>;
|
|
}>
|
|
> => {
|
|
// note: while hits have been renamed to views in most places, this API shouldn't change due to it being snapshotted
|
|
const views = await getAllViewCounts();
|
|
|
|
const total = {
|
|
hits: Object.values(views).reduce((acc, curr) => acc + curr, 0),
|
|
};
|
|
const pages = Object.entries(views).map(([slug, count]) => ({
|
|
slug,
|
|
hits: count,
|
|
}));
|
|
|
|
pages.sort((a, b) => b.hits - a.hits);
|
|
|
|
return NextResponse.json({ total, pages });
|
|
};
|