create single project page and set blog section in home page

This commit is contained in:
2025-06-19 20:17:15 +03:30
parent e69e2bf7e1
commit d44e8037b1
25 changed files with 423 additions and 109 deletions
+28
View File
@@ -0,0 +1,28 @@
import { NextResponse } from 'next/server';
import { cookies } from 'next/headers';
import { projects } from '../data';
export async function GET(request: Request, context: any) {
const params = await context.params;
const projectId = params.id;
const cookieStore = await cookies();
const lang = cookieStore.get('locale')?.value || 'en';
let project = projects.find((project) => project.id === projectId);
if (!project) {
return NextResponse.json({ error: 'Not found' }, { status: 404 });
}
if (lang === 'fa') {
project = {
...project,
title: project.fa_title || project.title,
content: project.fa_content || project.content,
};
}
return NextResponse.json({
data: project,
});
}