View Code? Open in Web Editor
NEW
An API for restaurants made with NodeJS, Express and MongoDB
License: GNU General Public License v3.0
JavaScript 99.79%
Shell 0.21%
aji-de-fideo-api's Introduction
- I am a JS and Python developer
- I was made in El Alto, Bolivia
- I try to find the intersection between art and tech.
aji-de-fideo-api's People
Contributors
Stargazers
Watchers
aji-de-fideo-api's Issues
==============================
this code can work:
const client = require('../db');
const { ObjectID } = require('../db');
const getUsers = () => {
const users = client.db('ajidefideo').collection('users');
const query = {};
const options = {
projection: { password: 0 },
}
return users.find(query, options).toArray();
}
const getOneUser = (uid) => {
const users = client.db('ajidefideo').collection('users');
try {
const id = ObjectID(uid);
return users.findOne({ _id: id })
} catch {
return users.findOne({ "email": uid });
}
}
module.exports = {
getOneUser,
getUsers
};
Pending tasks:
- Improve the way we call to the MongoDB driver (check express docs about calling MongoDB)****
- create user
- read user/s
- update user
- delete user