import { User } from "@models/user"; export default eventHandler(async (ev) => { const q = getQuery(ev); const regex = new RegExp(`.*${q.name}.*`, "i"); const users = await User.find({ username: regex, banned: false, }) .select("username _id") .exec(); return users.map((a) => a.toObject()); });