's'
This commit is contained in:
26
app/api/home/navigation/route.ts
Normal file
26
app/api/home/navigation/route.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import navigationData from '@/navsphere/content/navigation.json'
|
||||
|
||||
export const runtime = 'edge'
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
return NextResponse.json(navigationData, {
|
||||
headers: {
|
||||
'Cache-Control': 's-maxage=3600, stale-while-revalidate',
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Error in navigation API:', error)
|
||||
return NextResponse.json(
|
||||
{ error: '获取导航数据失败' },
|
||||
{
|
||||
status: 500,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
16
app/api/home/site/route.ts
Normal file
16
app/api/home/site/route.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import siteData from '@/navsphere/content/site.json'
|
||||
|
||||
export const runtime = 'edge'
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
return NextResponse.json(siteData)
|
||||
} catch (error) {
|
||||
console.error('Error in site API:', error)
|
||||
return NextResponse.json(
|
||||
{ error: '获取站点数据失败' },
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user