An API for rating beer using Punk API to demonstrate a basic API framework using:
- Express.js (server)
- Axios (for connecting to Punk API)
- body-parser (for parsing JSON requests)
- Jest (unit tests)
- nosql (local database)
- memory-cache (external request caching)
In the project directory, you can run:
Installs the server project's dependencies.
Runs the server in development mode.
Open http://localhost:5000 to view it in the browser.
Runs the Jest tests for the server project.
Below is a list of the available endpoints with examples.
Returns all beers with partial matches of 'Weiss'. A sample response:
[
{
"id": 3,
"name": "Berliner Weisse With Yuzu - B-Sides",
"description": "Japanese citrus fruit intensifies the sour nature of this German classic.",
"first_brewed": "11/2015",
"food_pairing": [
"Smoked chicken wings",
"Miso ramen",
"Yuzu cheesecake"
]
},
{
"id": 35,
"name": "Berliner Weisse With Raspberries And Rhubarb - B-Sides",
"description": "Tart, dry and acidic with a punch of summer berry as rhubarb crumble.",
"first_brewed": "11/2015",
"food_pairing": [
"Grilled salmon",
"Mac and cheese fries",
"Cheesecake with raspberry coulis"
]
},
...
]
Adds a beer rating with an Id of 3 and the following body:
{
"rating": 4,
"comments": "This beer is tasty."
}
Note: Request must have an x-user header containing a valid email address and the request will be logged to the database along with it.
Returns all beer rating objects with an Id of 3 or null if not found. A sample response:
[
{
"id": 3,
"rating": 4,
"comments": "This beer is tasty."
}
]
The client app with documentation can be found in the /client folder.
- Add better email validation and authorization
- Add endpoint for getting beer from Punk API by ID
- Store user information with the beer rating
- Add a primary key for beer ratings