Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Johnson authored and mj0730 committed Apr 2, 2020
1 parent 4102eda commit 8fbb2cd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`))
})
Expand Down

0 comments on commit 8fbb2cd

Please sign in to comment.