Skip to content

Commit

Permalink
add new heroku link, fix the routes
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrabosk committed May 6, 2019
1 parent 302f215 commit debf1ee
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ The available endpoints are the following:

| Method | Endpoint | Response (200) | Action |
| ------ | -------- | ------------------ | ------ |
| GET | /all | Beers[] | Get all the beers from the DB |
| GET | /single/:id | { Beer } | Get the a single/specific beer |
| GET | /random | { Beer } | Get a random beer from the DB |
| POST | /new | { Message: OK } | Create a new beer (the fields are specified in the instructions)|
| GET | /search?q=`{query}` | Beers[10] | Search with a RegEx using the `query` specified and return the first 10 results |
| GET | / | [beers] | Get all the beers from the DB |
| GET | /:id | { beer } | Get the a single/specific beer |
| GET | /random | { beer } | Get a random beer from the DB |
| POST | /new | { message: "New beer successfully saved to database!"}| Create a new beer (the fields are specified in the instructions)|
| GET | /search?q=`{query}` | [beers] | Search the DB based on the beer name using RegEx based on the `query` and return the array with results |

On each iteration, we will explain which endpoint you should use!

Expand All @@ -54,7 +54,7 @@ The **IronBeers** project will include the following features:

## Instructions

:exclamation: At the very beginning we will offer you to shoot for the stars: as a **bonus** focus on **mobile first** design! As we said this is bonus, so it's up to you 🥳
:exclamation: At the very beginning we will offer you to shoot for the stars: as a **bonus** focus on **mobile first** design! As we said this is bonus, so it's up to you :+1:

### Iteration 1: Create the App

Expand Down Expand Up @@ -84,7 +84,7 @@ On every view (except for the `home`), we should add a **header** with a `link`

### Iteration 4: List the Beers

On the `/beers` route, we should display all the beers from the database. So, in this case, you need to "hit" the API's route `https://ironbeer-api.herokuapp.com/beers/all` and the API will return an **array of beers**.
On the `/beers` route, we should display all the beers from the database. So, in this case, you need to "hit" the API's route `https://ih-beer-api.herokuapp.com/beers` and the API will return an **array of beers**.

*Hint*: The array of beers is array of objects. We strongly advise you to **console log the response** from the API so you can see the structure of it.

Expand Down Expand Up @@ -122,7 +122,7 @@ Again, we **strongly recommend to console log the response from the API**.

### Iteration 6: Random Beer

On the `/random-beer` route, we will render a single beer that will be retrieved from the database. The endpoint will do all the job for us, all we need to do is to call `https://ironbeer-api.herokuapp.com/beers/random`. We should receive an object including all the info about a beer.
On the `/random-beer` route, we will render a single beer that will be retrieved from the database. The endpoint will do all the job for us, all we need to do is to call `https://ih-beer-api.herokuapp.com/beers/random`. We should receive an object including all the info about a beer.
The same way we did with the **Single Beer** view, we should render the following fields:

- `image`
Expand Down Expand Up @@ -150,7 +150,7 @@ Finally, on the `/new-beer` route (remember, this is you react route, you're dis
- **contributed_by** - must be type *text*

Why we pointed out the type? Well, since we already console log response from the API, we could notice that all the fields are strings but *attenuation_level*, which is number. Using our knowledge from module II, we can make conclusion that in the *beer model* all the properties are type *String* except *attenuation_level*, which is type *Number*.
When you have built the form, you should do a `POST` request to `https://ironbeer-api.herokuapp.com/beers/new`, passing all the data on the `body` object. If everything went ok, you would receive a **200** response from the server.
When you have built the form, you should do a `POST` request to `https://ih-beer-api.herokuapp.com/beers/new`, passing all the data on the `body` object. If everything went ok, you would receive a **200** response from the server.

Notice that the fields on the `body` should have those specific **names** so the API can create a new beer.

Expand All @@ -164,12 +164,11 @@ Since we didn't cover how to upload images yet, don't worry about it now - the A

### (Extra) Bonus Iteration: Filter the Beers

Yes! One endpoint left! On the `/beers` route, add an `input` where users can search for beers. Every time a new letter is typed, you should call to `https://ironbeer-api.herokuapp.com/beers/search?q={query}` passing the value of the input in the `q` param.
Yes! One endpoint left! On the `/beers` route, add an `input` where users can search for beers. Every time a new letter is typed, you should call to `https://ih-beer-api.herokuapp.com/beers/search?q={query}` passing the value of the input in the `q` param.

**We are done!** 🏆
**We are done!** :trophy:

Awesome! Grab a beer (if you're not underage :wink: )! Now you are a **React Warrior**, keep training to become the Ninja!


Happy coding! :heart:

Happy coding! :heart:

0 comments on commit debf1ee

Please sign in to comment.