feat: implement email sending functionality with nodemailer; add contact form handling and success/error notifications

This commit is contained in:
2025-02-04 21:12:13 +01:00
parent 2c9f69dcac
commit 05f879d226
7 changed files with 199 additions and 22 deletions

View File

@@ -1,29 +1,29 @@
// app/api/stats/route.ts
import { NextResponse } from "next/server";
// app/api/stats/route.tsx
import {NextResponse} from "next/server";
const stats = {
views: 0,
projectsViewed: {} as { [key: string]: number },
views: 0,
projectsViewed: {} as { [key: string]: number },
};
export async function GET() {
return NextResponse.json(stats);
return NextResponse.json(stats);
}
export async function POST(request: Request) {
const { type, projectId } = await request.json();
const {type, projectId} = await request.json();
if (type === "page_view") {
stats.views += 1;
}
if (type === "project_view" && projectId) {
if (stats.projectsViewed[projectId]) {
stats.projectsViewed[projectId] += 1;
} else {
stats.projectsViewed[projectId] = 1;
if (type === "page_view") {
stats.views += 1;
}
}
return NextResponse.json({ message: "Stats updated", stats });
if (type === "project_view" && projectId) {
if (stats.projectsViewed[projectId]) {
stats.projectsViewed[projectId] += 1;
} else {
stats.projectsViewed[projectId] = 1;
}
}
return NextResponse.json({message: "Stats updated", stats});
}