import db from "@/app/lib/db";



export async function GET() {
  try {
    const [rows] = await db.query('SELECT NOW() AS time');
    return Response.json({ success: true, serverTime: rows[0].time });
  } catch (error) {
    console.error('❌ Full MySQL Error:', error); // this will help us
    return Response.json(
      {
        success: false,
        error: error?.message || 'Unknown error',
        details: error, // <— include the full object
      },
      { status: 500 }
    );
  }
}