server initial commit

This commit is contained in:
Ari Yeger
2025-07-15 13:34:30 -04:00
parent cf3f4270f9
commit 5fc2a1eb24
11 changed files with 1694 additions and 0 deletions

23
server/models/users.js Normal file
View File

@ -0,0 +1,23 @@
import db from "./db.js";
/** @typedef User
* @property {number} id - The unique identifier for the user.
* @property {string} username - The username of the user.
* @property {string} password - The hashed password of the user.
*/
/**
* Fetches all users from the database.
* @return {Promise<User[]>}
*/
const getAllUsers = async () => {
try {
return await db.query('SELECT * FROM users').then((users) => users);
} catch (error) {
console.error('Error fetching users:', error);
throw error;
}
}
export default {
getAllUsers
}