20 lines
426 B
JavaScript
Raw Normal View History

2024-07-03 23:46:00 +00:00
import { Router } from "express";
export const router = Router({ mergeParams: true });
const checkAuth = global.utils.checkAuth;
2024-07-03 23:46:00 +00:00
/**
* GET - get all users
* responses:
* - 200: {auth:true, users: Array}
* - 201: {auth: false}
*/
router.get("/", async (req, res) => {
// check auth
const auth = await checkAuth(req.cookies, res);
2024-07-03 23:46:00 +00:00
if (!auth) {
return;
}
res.status(200).send(global.userManager.getAllUsers());
});