This application is meant to make it easier for people to donate to charitable causes by providing them with a place where they can keep track of their favorite charities and see what charities their friends support
- HTML / CSS / JavaScript
- Fetch / AJAX
- Pledge API
- Bootstrap
- Local Storage
- AM Maps
- GraphQL
- Apollo
- Node
- NPM
- Express
- MongoDB
- Mongoose
- JWT
The following code snippet demonstrates key data that is retrieved from our local database and the Pledge API through our Users Query.
export const QUERY_USERS = gql`
query users {
firstName
lastName
email
password
friends {
firstName
lastName
}
charities {
address
causes
charityID
logo_Url
mission
name
pledge_Url
website_Url
}
}
`;
This next snippet displays the client-side event listener that calls the Pledge API to return the charity data.
if (!data.charity) {
fetch("https://api.pledge.to/v1/organizations/" + orgId, {
method: "GET",
mode: "cors",
headers: {
Authorization: "Bearer " + process.env.PLEDGE_API_KEY,
},
})
.then((response) => {
console.log(response);
if (response.ok) {
response.then((json) => {
let charityResponse = {
address: json.street1 + ", " + json.city + " " + json.region,
causes: [],
charityID: json.id,
logo_url: json.logo_url,
mission: json.mission,
name: json.name,
pledge_Url: json.website_url,
};
setCharity(charityResponse);
console.log(charityResponse);
});
} else {
console.log("Error with request");
}
Simply visit the site using the following link!
Contact one of us via email
If you have any questions about this project, feel free to reach out to one of us at:
[email protected]
[email protected]
[email protected]
[email protected]