streamer2 / pages /api /rooms.ts
copilot-swe-agent[bot]
Add name input, public/private rooms, and lobby listing features
3394d66
import { getPublicRooms } from "../../lib/cache"
import { NextApiRequest, NextApiResponse } from "next"
export default async function rooms(_: NextApiRequest, res: NextApiResponse) {
const publicRooms = await getPublicRooms()
// Return simplified room info for the lobby
const roomList = publicRooms.map(room => ({
id: room.id,
ownerName: room.ownerName || "Unknown",
memberCount: room.users.length,
}))
res.json({ rooms: roomList })
}