API for Bountiful Children's Foundation. Click here to view the Technical Design Document for this project.
URL: https://bcf-backend.herokuapp.com
POST https://bcf-backend.herokuapp.com/users/register
Name | Type | Description |
---|---|---|
firstname | string | user's first name |
lastname | string | user's last name |
country | string | user's country |
title | string | either "Coordinator" or "Donor" |
string | user's email address | |
username | string | user's username |
password | string | user's password |
axios.post("https://bcf-backend.herokuapp.com/users/register", {
"firstname": "Jane",
"lastname": "Doe",
"country": "Peru",
"title": "Coordinator",
"email": "[email protected]",
"username": "janedoe",
"password": "janedoe"
})
axios.post("https://bcf-backend.herokuapp.com/users/register", {
"firstname": "Bill",
"lastname": "Gates",
"country": "Brazil",
"title": "Donor",
"email": "[email protected]",
"username": "billgates",
"password": "billgates"
})
Successful Registration:
{
"message": "Welcome Jane! Your username is janedoe.",
"user": {
"id": 1,
"firstname": "Jane",
"lastname": "Doe",
"country": "Peru",
"title": "Coordinator",
"email": "[email protected]",
"username": "janedoe",
"password": "$2a$14$YjkxrBK9pu01.L78SyB.wOeX9BNPn9dJbintMMvsTwLqCxNPlZ8sa"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0IjoxLCJ1c2VybmFtZSI6ImphbmVkb2UiLCJ0aXRsZSI6IkNvb3JkaW5hdG9yIiwiaWF0IjoxNTU4MjA4OTAzLCJleHAiOjE1NTg5Mjg5MDN9.TNdbditpT9iy7xfJFjJF5pjSApn2ybDtJg7oGmpcncI"
}
Registration Error:
ERROR XXX
{
"error": "Some Error Message"
}
POST https://bcf-backend.herokuapp.com/users/login
Name | Type | Description |
---|---|---|
username | string | user's username |
password | string | user's password |
axios.post("https://bcf-backend.herokuapp.com/users/login", {
"username": "janedoe",
"password": "janedoe"
})
Successful Login:
{
"message": "Welcome janedoe!",
"user": {
"id": 1,
"firstname": "Jane",
"lastname": "Doe",
"country": "Peru",
"title": "Coordinator",
"email": "[email protected]",
"username": "janedoe",
"password": "$2a$14$YjkxrBK9pu01.L78SyB.wOeX9BNPn9dJbintMMvsTwLqCxNPlZ8sa"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0IjoxLCJ1c2VybmFtZSI6ImphbmVkb2UiLCJ0aXRsZSI6IkNvb3JkaW5hdG9yIiwiaWF0IjoxNTU4MjA5MTMyLCJleHAiOjE1NTg5MjkxMzJ9.2Rbb_6EGDtvaNkZu50dOpcNJ5Kk4B_-R3w7OH8oC7yI"
}
Login Error:
ERROR XXX
{
"error": "Some Error Message"
}
GET https://bcf-backend.herokuapp.com/users/:id
Name | Type | Description |
---|---|---|
id | number | user's ID |
axios.get("https://bcf-backend.herokuapp.com/users/1")
User Data:
{
"id": 1,
"firstname": "Jane",
"lastname": "Doe",
"country": "Peru",
"title": "Coordinator",
"email": "[email protected]",
"username": "janedoe",
"password": "$2a$14$YjkxrBK9pu01.L78SyB.wOeX9BNPn9dJbintMMvsTwLqCxNPlZ8sa",
"stories": [
{
"id": 1,
"title": "A Moment in Peru",
"country": "Peru",
"description": "Full story goes here.",
"date": "May 17, 2019"
},
{
"id": 2,
"title": "A Tour in Ghana",
"country": "Ghana",
"description": "A cool story that happened in Ghana",
"fullStory": "Full story goes here.",
"date": "May 17, 2019"
},
{
"id": 3,
"title": "A Day in Cambodia",
"country": "Cambodia",
"description": "A cool story that happened in Cambodia",
"fullStory": "Full story goes here",
"date": "May 17, 2019"
}
]
}
ERROR XXX
{
"error": "Some Error Message"
}
GET https://bcf-backend.herokuapp.com/stories
axios.get("https://bcf-backend.herokuapp.com/stories");
Stories Data
[
{
"id": 1,
"user_id": 1,
"title": "A Moment in Peru",
"country": "Peru",
"description": "A cool story that happened in Peru",
"fullStory": "Full story goes here.",
"date": "May 17, 2019"
},
{
"id": 2,
"user_id": 1,
"title": "A Tour in Ghana",
"country": "Ghana",
"description": "A cool story that happened in Ghana",
"fullStory": "Full story goes here.",
"date": "May 17, 2019"
},
{
"id": 3,
"user_id": 1,
"title": "A Day in Cambodia",
"country": "Cambodia",
"description": "A cool story that happened in Cambodia",
"fullStory": "Full story goes here.",
"date": "May 17, 2019"
},
{
"id": 4,
"user_id": 2,
"title": "A Life in Haiti",
"country": "Haiti",
"description": "A cool story that happened in Haiti",
"fullStory": "Full story goes here.",
"date": "May 17, 2019"
},...
]
ERROR XXX
{
"error": "Some Error Message"
}
GET https://bcf-backend.herokuapp.com/stories/:id
axios.get("https://bcf-backend.herokuapp.com/stories/3");
Name | Type | Description |
---|---|---|
id | integer | story's ID |
Story Data
{
"id": 3,
"user_id": 1,
"title": "A Day in Cambodia",
"country": "Cambodia",
"description": "A cool story that happened in Cambodia",
"fullStory": "Full story goes here.",
"date": "May 17, 2019",
"created_at": "2019-05-18 19:00:19",
"updated_at": "2019-05-18 19:00:19"
}
ERROR XXX
{
"error": "Some Error Message"
}
POST https://bcf-backend.herokuapp.com/stories
Name | Type | Description |
---|---|---|
user_id | integer | user's ID |
title | string | title of story |
country | string | country of story |
description | string | preview of story |
fullStory | string | the full story |
date | string | date of story |
axios.post("https://bcf-backend.herokuapp.com/stories", {
"user_id": 1,
"title": "The Grand Zimbabwe",
"country": "Zimbabwe",
"description": "Preview of cool story",
"fullStory": "Full story about Zimbabwe",
"date": "May 18, 2019"
});
Story Data
{
"id": 7,
"user_id": 1,
"title": "The Grand Zimbabwe",
"country": "Zimbabwe",
"description": "Preview of cool story",
"fullStory": "Full story about Zimbabwe",
"date": "May 18, 2019",
"created_at": "2019-05-18 23:04:15",
"updated_at": "2019-05-18 23:04:15"
}
ERROR XXX
{
"error": "Some Error Message"
}
PUT https://bcf-backend.herokuapp.com/stories/:id
Name | Type | Description |
---|---|---|
id | integer | story's ID |
user_id | integer | user's ID |
title | string | title of story |
country | string | country of story |
description | string | preview of story |
fullStory | string | the full story |
date | string | date of story |
axios.put("https://bcf-backend.herokuapp.com/stories/7", {
"user_id": 1,
"title": "The VERY Grand Zimbabwe",
"country": "Zimbabwe",
"description": "Preview of cool story",
"fullStory": "Full story about Zimbabwe",
"date": "May 18, 2019"
});
{
"message": "1 story updated!"
}
ERROR XXX
{
"error": "Some Error Message"
}
DELETE https://bcf-backend.herokuapp.com/stories/:id
Name | Type | Description |
---|---|---|
id | integer | story's ID |
axios.delete("https://bcf-backend.herokuapp.com/stories/7");
{
"message": "1 story deleted!"
}
ERROR XXX
{
"error": "Some Error Message"
}