Spaces:
Sleeping
Sleeping
| 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 } | |
| ); | |
| } | |
| } |