change name action for api

This commit is contained in:
Nikolai Petukhov
2024-10-03 22:35:39 +03:00
parent 6bea0428f4
commit 8d0fadc906
12 changed files with 123 additions and 70 deletions
+17
View File
@@ -0,0 +1,17 @@
// 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}