import { d as db, g as servers } from '../admin/create-upload-progress-table/POST-C-OoiMoW.js';
import { desc } from 'drizzle-orm';

async function handler(req, res) {
  try {
    const allServers = await db.select().from(servers).orderBy(desc(servers.lastPing));
    res.json({
      success: true,
      servers: allServers
    });
  } catch (error) {
    console.error("Servers fetch error:", error);
    res.status(500).json({
      success: false,
      error: "Failed to fetch servers",
      message: String(error)
    });
  }
}

export { handler as h };
