function adminCheck(inp) {
fs.readFile('./files/admins', 'utf8', (err, data) => {
if (err) {
console.log(err);
}
if(data.includes(inp)){
console.log('Admin')
return true;
}else{
console.log('Non-admin')
return false;
}
})
};
I want to check if a user is in the admin file. The console messages in the function are signaling correctly when I add/remove a username. But the function is not returning T/F when I call with:
console.log(adminCheck(request.session.username))
It just console logs "undefined" so I can't do anything with it, I cannot figure out why. Any thoughts?