Polarcraft/web/server/api/auth/getusers.js
Xeovalyte 8121b9b975
Some checks failed
Build and Deploy / Deploy Web (push) Has been cancelled
Build and Deploy / Deploy Discord Bot (push) Has been cancelled
Lots of improvements and changes
2023-05-27 12:02:33 +02:00

14 lines
365 B
JavaScript

export default defineEventHandler(async (event) => {
const user = await getAuth(event)
if (!user.role.moderator) return createError({ statusCode: 403, statusMessage: 'Gebruiker heeft geen toegang tot alle gebruikers' })
const usersColl = db.collection('users');
const cursor = usersColl.find()
const users = await cursor.toArray()
return users
});