d5575b58e3
Features: - Mission Control dashboard - HP Submissions tracking - AI Agents integration - Lead management CRM - Marketing email templates - Chrome extension support Tech: Next.js, TypeScript, Tailwind CSS, MySQL
31 lines
912 B
TypeScript
31 lines
912 B
TypeScript
import { NextResponse } from 'next/server'
|
|
import fs from 'fs'
|
|
import path from 'path'
|
|
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
export async function GET() {
|
|
try {
|
|
// Try multiple possible paths
|
|
const possiblePaths = [
|
|
path.join(process.cwd(), '..', 'hostpioneers.com', 'public_html', 'contacts.json'),
|
|
path.join(process.cwd(), 'public', '..', 'contacts.json'),
|
|
'/var/www/hostpioneers.com/public_html/contacts.json',
|
|
]
|
|
|
|
let data = '[]'
|
|
for (const filePath of possiblePaths) {
|
|
if (fs.existsSync(filePath)) {
|
|
data = fs.readFileSync(filePath, 'utf-8')
|
|
break
|
|
}
|
|
}
|
|
|
|
const submissions = JSON.parse(data || '[]')
|
|
return NextResponse.json({ submissions: submissions.reverse() })
|
|
} catch (error) {
|
|
console.error('Error:', error)
|
|
return NextResponse.json({ submissions: [], error: 'Failed to fetch' }, { status: 200 })
|
|
}
|
|
}
|