diff --git a/README.md b/README.md index 205c5e5..c6bd229 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,21 @@ ## Usage -> Some usage instructions +### CRUD API +To create a new user in the database: +send POST request to domain/api/users with the user name in the body of the request with the name field (name: username) -## Requirements +To find a specific user by name: +send GET request to domain/api/users/username + +To update a user avatar: +send PUT request to domain/api/users with the user name in the body of the request with the name field (name: username) +This assigns a random image to the user -An `nvmrc` file is included if using [nvm](https://github.com/creationix/nvm). +To delete all reviews for a property listing: +send DELETE request to domain/api/rentals/id where id is the number id of the listing -- Node 6.13.0 -- etc +## Requirements ## Development diff --git a/server/index.js b/server/index.js index f914a9c..6094c6f 100644 --- a/server/index.js +++ b/server/index.js @@ -60,7 +60,7 @@ app.get('/api/users/:userName', (req, res) => { app.put('/api/users', (req, res) => { let q = {name: req.body.name}; User.updateOne(q, { $set: { imageUrl: 'https://picsum.photos/80'}}) - .then(data => console.log(`${res.result.nModified} document updated: ${data}`)) + .then(console.log(`Document updated`)) .then(res.sendStatus(200)) .catch(err => console.log(`ERROR updating ${q}: ${err}`)) })