18 lines
360 B
JavaScript
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}
|