/** * To be able to run this we need to set our dev pc in the .env. * if its empty just ignore it. this will just be the double catch */ import { fromNodeHeaders } from "better-auth/node"; import { Router } from "express"; import { auth } from "../utils/auth.utils.js"; import { apiReturn } from "../utils/returnHelper.utils.js"; const r = Router(); r.get("/", async (req, res) => { const { users } = await auth.api.listUsers({ query: { limit: 50, }, headers: fromNodeHeaders(req.headers), }); // console.log(error); // if (error) { // return apiReturn(res, { // success: false, // level: "info", // module: "admin", // subModule: "user", // message: `There was an error getting the users.`, // data: users, // status: 400, // }); // } return apiReturn(res, { success: true, level: "info", module: "admin", subModule: "users", message: `Current active users.`, data: users, status: 200, }); }); export default r;