This repository has been archived on 2026-05-01. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
chatless/backend/service-authentication/getUsers.js
2021-05-31 02:51:28 +02:00

16 lines
482 B
JavaScript

const {sendError, sendMessage} = require ("./message");
const queries = require('./mongodbQueries');
async function getUsers (req,res) {
if (typeof req.body.username === 'undefined')
return sendError(res, 'Vous n\'avez pas envoyé le champ username');
const users = await queries.getUsersQuery(req.body.username);
if (users){
return sendMessage(res, users);
}
else{
return sendError(res, 'no users');
}
}
module.exports = getUsers;