front/stubs/api/db.js
2024-10-03 22:35:39 +03:00

18 lines
360 B
JavaScript

// Read already defined users (pseudo-DB)
const users = require('./auth/users.json');
const getUserFromDB = (userID) => {
if (!userID) {return false;}
// Accessing 'DB'
const user = users.find((user) => user.id === userID);
if (user) {
return user;
} else {
return false;
}
}
module.exports = {users, getUserFromDB}