Spaces:
Sleeping
Sleeping
File size: 804 Bytes
5f2aab6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import { NextResponse } from 'next/server';
import fs from 'fs';
import path from 'path';
export async function GET() {
try {
// tmpディレクトリのCNデータを読み込み
const filePath = path.join(process.cwd(), 'tmp', 'get_proposal_cn_all_section.json');
if (!fs.existsSync(filePath)) {
return NextResponse.json(
{ error: 'CNデータファイルが見つかりません' },
{ status: 404 }
);
}
const fileContent = fs.readFileSync(filePath, 'utf-8');
const cnData = JSON.parse(fileContent);
return NextResponse.json(cnData);
} catch (error) {
console.error('[CN Data Loader] Error:', error);
return NextResponse.json(
{ error: 'CNデータの読み込みに失敗しました' },
{ status: 500 }
);
}
} |