front/stubs/api/db.js

18 lines
360 B
JavaScript
Raw Normal View History

2024-10-03 22:35:39 +03:00
// 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}