API link:
https://chef-portfolio-2.herokuapp.com/
Users: [
{
"first_name": "testing",
"last_name": "testing",
"username": "chef",
"password": "password"
"email": "chef@email.com",
"location": "Seattle, WA"
}
]
Posts: [
{
"chef_name": "chef",
"title": "Macaroni and Cheese",
"photo": "https://images.pexels.com/photos/806357/pexels-photo-806357.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
"meal_type": "dinner",
"ingredients": "8oz elbow macaroni, 2 cups shredded sharp cheddar cheese, 1/2 cup grated parmesan cheese, 3 cups milk, 1/4 cup butter, 2 1/2 tablespoons all-purpose flour, 2 tablespoons butter, 1/2 cup breadcrumbs, 1 pinch paprika",
"instructions": "Cook macaroni according to the package directions. Drain., In a saucepan melt butter or margarine over medium heat. Stir in enough flour to make a roux. Add milk to roux slowly, stirring constantly. Stir in cheeses and cook over low heat until cheese is melted and the sauce is a little thick. Put macaroni in large casserole dish and pour sauce over macaroni. Stir well., Melt butter or margarine in a skillet over medium heat. Add breadcrumbs and brown. Spread over the macaroni and cheese to cover. Sprinkle with a little paprika., Bake at 350 degrees F (175 degrees C) for 30 minutes. Serve."
}
]
| Table | Method | Endpoint | Description |
|---|---|---|---|
| users | POST | /api/auth/register | Registers a new user. |
| users | POST | /api/auth/login | Logs in already registered user. |
Method URL: /api/auth/register
HTTP Method: [POST]
| Name | Type | Required | Description |
|---|---|---|---|
first_name |
String | Yes | |
last_name |
String | Yes | |
username |
String | Yes | Must be unique. |
password |
String | Yes | |
email |
String | Yes | |
location |
String | Yes |
{
"first_name": "testing",
"last_name": "testing",
"username": "chef",
"password": "password",
"email": "chef@email.com",
"location": "Seattle, WA"
}
If you successfully register a user, the endpoint will return an HTTP response with a status code
201.
If you are missing a username or password, the endpoint will return an HTTP response with a status code of
400.
If there is a server or database error, the endpoint will return an HTTP response with a status code of
500.
Method URL: /api/auth/login
HTTP Method: [POST]
| Name | Type | Description |
|---|---|---|
username |
String | Must match username in database. |
password |
String | Must match password to corresponding username in database. |
{
"username": "chef",
"password": "password"
}
If you successfully log in, the endpoint will return an HTTP response with a status code
200.
If you are missing a username or a password, the endpoint will return an HTTP response with a status code of
400.
If you provide invalid credentials, the endpoint will return an HTTP response with a status code of
401.
If there is a server or database error, the endpoint will return an HTTP response with a status code of
500.
Method URL: /api/users/
HTTP Method: [GET]
| Name | Type | Required | Description |
|---|---|---|---|
Content-Type |
String | Yes | Must be application/JSON |
Authorization |
String | Yes | JSON Web Token |
If users are found, the endpoint will return an HTTP response with a status code
200.
If users are not found, the endpoint will return an HTTP response with a status code
404.
If user does not have access, the endpoint will return an HTTP response with a status code of
401.
If there is a server or database error, the endpoint will return an HTTP response with a status code of
500.
Method URL: /api/posts
HTTP Method: [POST]
| Name | Type | Required | Description |
|---|---|---|---|
Content-Type |
String | Yes | Must be application/JSON |
Authorization |
String | Yes | JSON Web Token |
| Name | Type | Required | Description |
|---|---|---|---|
chef_name |
String | Yes | |
title |
String | Yes | |
photo |
String | Yes | |
meal_type |
String | Yes | |
ingredients |
String | Yes | |
instructions |
String | Yes |
{
"chef_name": "chef",
"title": "Macaroni and Cheese",
"photo": "https://images.pexels.com/photos/806357/pexels-photo-806357.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
"meal_type": "dinner",
"ingredients": "8oz elbow macaroni, 2 cups shredded sharp cheddar cheese, 1/2 cup grated parmesan cheese, 3 cups milk, 1/4 cup butter, 2 1/2 tablespoons all-purpose flour, 2 tablespoons butter, 1/2 cup breadcrumbs, 1 pinch paprika",
"instructions": "Cook macaroni according to the package directions. Drain., In a saucepan melt butter or margarine over medium heat. Stir in enough flour to make a roux. Add milk to roux slowly, stirring constantly. Stir in cheeses and cook over low heat until cheese is melted and the sauce is a little thick. Put macaroni in large casserole dish and pour sauce over macaroni. Stir well., Melt butter or margarine in a skillet over medium heat. Add breadcrumbs and brown. Spread over the macaroni and cheese to cover. Sprinkle with a little paprika., Bake at 350 degrees F (175 degrees C) for 30 minutes. Serve."
}
If post is created, the endpoint will return an HTTP response with a status code
201.
If you are missing any post information, the endpoint will return an HTTP response with a status code of
400.
If user does not have access, the endpoint will return an HTTP response with a status code of
401.
If there is a server or database error, the endpoint will return an HTTP response with a status code of
500.
Method URL: /api/posts
HTTP Method: [GET]
No headers needed. /api/posts is not a protected path.
If posts are found, the endpoint will return an HTTP response with a status code
200.
If posts are not found, the endpoint will return an HTTP response with a status code
404.
If there is a server or database error, the endpoint will return an HTTP response with a status code of
500.
Method URL: /api/posts/:id
HTTP Method: [GET]
No headers needed. /api/posts/:id is not a protected path.
If post with specified ID is found, the endpoint will return an HTTP response with a status code
200.
If post with specified ID is not found, the endpoint will return an HTTP response with a status code
404.
If there is a server or database error, the endpoint will return an HTTP response with a status code of
500.
Method URL: /api/posts/:id
HTTP Method: [PUT]
| Name | Type | Required | Description |
|---|---|---|---|
Content-Type |
String | Yes | Must be application/JSON |
Authorization |
String | Yes | JSON Web Token |
| Name | Type | Required | Description |
|---|---|---|---|
chef_name |
String | Yes | |
title |
String | Yes | |
photo |
String | Yes | |
meal_type |
String | Yes | |
ingredients |
String | Yes | |
instructions |
String | Yes |
{
"chef_name": "chef",
"title": "Macaroni and Cheese",
"photo": "https://images.pexels.com/photos/806357/pexels-photo-806357.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
"meal_type": "dinner",
"ingredients": "8oz elbow macaroni, 2 cups shredded sharp cheddar cheese, 1/2 cup grated parmesan cheese, 3 cups milk, 1/4 cup butter, 2 1/2 tablespoons all-purpose flour, 2 tablespoons butter, 1/2 cup breadcrumbs, 1 pinch paprika",
"instructions": "Cook macaroni according to the package directions. Drain., In a saucepan melt butter or margarine over medium heat. Stir in enough flour to make a roux. Add milk to roux slowly, stirring constantly. Stir in cheeses and cook over low heat until cheese is melted and the sauce is a little thick. Put macaroni in large casserole dish and pour sauce over macaroni. Stir well., Melt butter or margarine in a skillet over medium heat. Add breadcrumbs and brown. Spread over the macaroni and cheese to cover. Sprinkle with a little paprika., Bake at 350 degrees F (175 degrees C) for 30 minutes. Serve."
}
If post with specified ID is found and updated, the endpoint will return an HTTP response with a status code
200.
If post with specified ID is not found and updated, the endpoint will return an HTTP response with a status code
404.
If user does not have access, the endpoint will return an HTTP response with a status code of
401.
If there is a server or database error, the endpoint will return an HTTP response with a status code of
500.
Method URL: /api/posts/:id
HTTP Method: [DELETE]
| Name | Type | Required | Description |
|---|---|---|---|
Content-Type |
String | Yes | Must be application/JSON |
Authorization |
String | Yes | JSON Web Token |
If post with specified ID is found and deleted, the endpoint will return an HTTP response with a status code
200.
If post with specified ID is not found and deleted, the endpoint will return an HTTP response with a status code
404.
If user does not have access, the endpoint will return an HTTP response with a status code of
401.
If there is a server or database error, the endpoint will return an HTTP response with a status code of
500.