Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Mongoose READ

// Get all users
app.get('/users', (req, res) => {
  Users.find()
    .then((users) => {
      res.status(201).json(users);
    })
    .catch((err) => {
      console.error(err);
      res.status(500).send('Error: ' + err);
    });
});
Source by careerfoundry.com #
 
PREVIOUS NEXT
Tagged: #Mongoose #READ
ADD COMMENT
Topic
Name
9+4 =