Skip to content

added database configuration #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 141 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
0752362
Update Readme
parkersavage May 2, 2024
6916460
Update
parkersavage May 2, 2024
3a162d3
update
parkersavage May 2, 2024
ae674ed
505
HunterMena May 2, 2024
2f814bb
d
parkersavage May 2, 2024
b5f6078
Add files via upload
cdean97 May 2, 2024
2ffba6a
Add files via upload
cdean97 May 2, 2024
addbb35
test
parkersavage May 2, 2024
16e3268
Merge pull request #1 from parkersavage/branch1
cdean97 May 2, 2024
8903180
put new icons and sidebar label names
HunterMena May 2, 2024
aea9d03
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
HunterMena May 2, 2024
85ca01f
Added logo
cdean97 May 2, 2024
9beb299
Merge pull request #2 from parkersavage/PARKER_ONE
parkersavage May 2, 2024
69d65e9
commit
RackyAllen May 2, 2024
9ebc8e2
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
RackyAllen May 2, 2024
7a0b8dc
tables
HunterMena May 2, 2024
2185f70
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
HunterMena May 2, 2024
9bc4bd0
fix
parkersavage May 2, 2024
02b4be1
Removed Quick Links
cdean97 May 2, 2024
e5dc913
d
parkersavage May 2, 2024
f8aa829
Merge pull request #3 from parkersavage/parker_2
parkersavage May 2, 2024
e874226
commit
RackyAllen May 2, 2024
b55be97
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
RackyAllen May 2, 2024
c56ca32
Renamed tables and users to cookbook and pantry
HunterMena May 2, 2024
7e6b0e2
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
HunterMena May 2, 2024
f6b777f
changed icon for sidebar of cookbook pantry index
HunterMena May 2, 2024
1eac91e
commit
RackyAllen May 2, 2024
765409c
commit
RackyAllen May 2, 2024
72907b7
fixed sidebar navigation
HunterMena May 2, 2024
3a7b249
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
HunterMena May 2, 2024
d037d89
fixed cookbook sidebar navigation
HunterMena May 2, 2024
9f8bcc6
commit
RackyAllen May 2, 2024
c38fc01
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
RackyAllen May 2, 2024
f63daa3
Update pantry.html
parkersavage May 2, 2024
7517476
Update cookbook.html
parkersavage May 2, 2024
4283d1d
Added profile page
cdean97 May 2, 2024
3175f34
Merge pull request #4 from parkersavage/Parker_Cookbook
parkersavage May 2, 2024
23f71a5
commit
RackyAllen May 2, 2024
444eb89
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
RackyAllen May 2, 2024
54e41b7
Added ref to profile page
mrcdean16 May 2, 2024
3a16f6c
commit
RackyAllen May 2, 2024
8d24a8f
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
RackyAllen May 2, 2024
8e67f92
commit
RackyAllen May 2, 2024
f4ecd0d
added database configuration
asapsui May 2, 2024
2e28dc9
Changed Logo
mrcdean16 May 2, 2024
57410c1
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
mrcdean16 May 2, 2024
1662412
Added sidebar
mrcdean16 May 2, 2024
2e6fbb0
Profile
mrcdean16 May 2, 2024
d7c3b70
Update index.html
parkersavage May 2, 2024
a6c4b04
Merge pull request #5 from parkersavage/Parker
parkersavage May 2, 2024
a75bd6f
Merge branch 'main' of https://github.com/parkersavage/NewGroupB into…
asapsui May 2, 2024
b2365d9
Changed dropdown to button
mrcdean16 May 2, 2024
fc972c0
commit
RackyAllen May 2, 2024
72b6caf
Merge branch 'main' of https://github.com/parkersavage/NewGroupB into…
asapsui May 2, 2024
32dedb9
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
mrcdean16 May 2, 2024
2c0b79e
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
mrcdean16 May 2, 2024
caaad6a
Update index.html
parkersavage May 2, 2024
9ecee41
Merge pull request #6 from parkersavage/Parker
parkersavage May 2, 2024
7323a6b
Update index.html
parkersavage May 2, 2024
e022348
Merge pull request #7 from parkersavage/parker2
parkersavage May 2, 2024
6929a55
Replaced drop down w/profile button
mrcdean16 May 2, 2024
4a82752
Fixed cookbook header in the page
HunterMena May 2, 2024
1292dc6
Update index.html
parkersavage May 2, 2024
1504ae5
Merge pull request #8 from parkersavage/parkersavage-patch-2
parkersavage May 2, 2024
3f50535
Update index.html
parkersavage May 2, 2024
e289584
Update master.css
parkersavage May 2, 2024
c711fb9
Remove JS elements
mrcdean16 May 2, 2024
906b4de
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
mrcdean16 May 2, 2024
c43667b
Reverted
mrcdean16 May 2, 2024
a9b4feb
Changed view
mrcdean16 May 2, 2024
ea4276a
removed dropdown
mrcdean16 May 2, 2024
2cc367b
Removed drop down
mrcdean16 May 2, 2024
46f0493
added logout button
mrcdean16 May 2, 2024
106dd60
Create t
parkersavage May 2, 2024
88a61c7
Add files via upload
parkersavage May 2, 2024
e80bb30
Create Recipe.js
parkersavage May 2, 2024
e107e4a
renamed index to Home
HunterMena May 2, 2024
a7cd4bb
changed layout
mrcdean16 May 2, 2024
a8a134a
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
mrcdean16 May 2, 2024
c015c08
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
HunterMena May 2, 2024
ef1bd21
commit
RackyAllen May 2, 2024
48d7422
Update Home.html
parkersavage May 2, 2024
917347a
added login and register feature with database
asapsui May 2, 2024
1ea3d79
updated to match main
asapsui May 2, 2024
e2b81e2
Merge branch 'main' of https://github.com/parkersavage/NewGroupB into…
asapsui May 2, 2024
4d7bbf7
updated the database and converted some of the html files to ejs. Typ…
asapsui May 2, 2024
e477f1f
commit
RackyAllen May 2, 2024
cafe990
added database info file
asapsui May 2, 2024
f32371e
Merge branch 'main' of https://github.com/parkersavage/NewGroupB into…
asapsui May 2, 2024
e1c03dd
commit
RackyAllen May 2, 2024
ada64ad
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
RackyAllen May 2, 2024
6237722
A single typo was fixed
MasonSharum May 2, 2024
31d1f65
Update README.md
parkersavage May 2, 2024
e8c3c96
Merge branch 'main' of https://github.com/parkersavage/PanTRY
MasonSharum May 2, 2024
ed5f0c8
added add-ingredient.ejs file
asapsui May 2, 2024
ca62452
Merge branch 'main' of https://github.com/parkersavage/NewGroupB into…
asapsui May 2, 2024
813b724
commit
RackyAllen May 2, 2024
8c75c92
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
RackyAllen May 2, 2024
a4c86d3
commit
RackyAllen May 2, 2024
35b78b6
commit
RackyAllen May 2, 2024
0497a68
commit
RackyAllen May 2, 2024
9f3c06c
commit
RackyAllen May 2, 2024
b495d3d
Cookbook is basically gone
MasonSharum May 2, 2024
1777513
Merge branch 'main' of https://github.com/parkersavage/PanTRY
MasonSharum May 2, 2024
6cbc0fd
Add files via upload
jeepjeep32 May 2, 2024
e7b7598
Cookbook is actually gone now
MasonSharum May 2, 2024
404ce48
Merge branch 'main' of https://github.com/parkersavage/PanTRY
MasonSharum May 2, 2024
5d5e631
Cookbook Fixes
MasonSharum May 2, 2024
96156fc
commit
parkersavage May 2, 2024
1094954
More cookbook changes
MasonSharum May 2, 2024
5798ff8
Merge branch 'main' of https://github.com/parkersavage/PanTRY
MasonSharum May 2, 2024
0e2b8bf
Deleted sentence about adding things to the tables
MasonSharum May 2, 2024
53072f3
n/a
mrcdean16 May 2, 2024
07952f8
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
mrcdean16 May 2, 2024
dd98b2d
Table Title rename
MasonSharum May 2, 2024
bccfbbe
Merge branch 'main' of https://github.com/parkersavage/PanTRY
MasonSharum May 2, 2024
e5b1eaa
Changed ID to #
MasonSharum May 2, 2024
85f96f8
Formatting
mrcdean16 May 2, 2024
deffe4a
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
mrcdean16 May 2, 2024
941d096
Comments for Cookbook
MasonSharum May 2, 2024
e3b78eb
Merge branch 'main' of https://github.com/parkersavage/PanTRY
MasonSharum May 2, 2024
bc322a5
add title to home page
parkersavage May 2, 2024
a012b94
add ingredient
parkersavage May 2, 2024
bb06bcb
Comments for profile and login
HunterMena May 2, 2024
b35ce32
m
HunterMena May 2, 2024
caff342
Fix TItle
parkersavage May 2, 2024
5b9aa02
change spacing
parkersavage May 2, 2024
cd03e46
Add files via upload
jeepjeep32 May 2, 2024
0b5230f
Add files via upload
jeepjeep32 May 2, 2024
920cc27
added more stuff
asapsui May 2, 2024
f861a68
Merge branch 'main' of https://github.com/parkersavage/NewGroupB into…
asapsui May 2, 2024
a396fb4
nm
HunterMena May 2, 2024
811a87d
,
HunterMena May 2, 2024
cfef7ec
na
mrcdean16 May 2, 2024
04bae11
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
mrcdean16 May 2, 2024
ebe00a9
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
HunterMena May 2, 2024
e1d3e83
Merge branch 'main' of https://github.com/parkersavage/NewGroupB
HunterMena May 2, 2024
714b4e5
updated pantry
asapsui May 2, 2024
80f36d7
Merge branch 'main' of https://github.com/parkersavage/NewGroupB into…
asapsui May 2, 2024
9b4a768
updated pantry
asapsui May 2, 2024
c5f0097
Delete .env
asapsui May 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 4 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/NewGroupB.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions 404.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<!doctype html>
<!--
* Bootstrap Simple Admin Template
* Version: 2.1
* Author: Alexis Luna
* Website: https://github.com/alexis-luna/bootstrap-simple-admin-template
-->
<html lang="en">

<head>
Expand Down
8 changes: 1 addition & 7 deletions 500.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<!doctype html>
<!--
* Bootstrap Simple Admin Template
* Version: 2.1
* Author: Alexis Luna
* Website: https://github.com/alexis-luna/bootstrap-simple-admin-template
-->
<html lang="en">

<head>
Expand All @@ -21,7 +15,7 @@
<div class="page vertical-align text-center">
<div class="page-content vertical-align-middle">
<header>
<h1 class="animation-slide-top">500</h1>
<h1 class="animation-slide-top">505</h1>
<p>Internal Server Error !</p>
</header>
<p class="error-advise">Whoopps, something went wrong.</p>
Expand Down
26 changes: 26 additions & 0 deletions API/Driver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const SpoonableAPI = require('./SpoonableAPI');

class Driver {
static async run() {
const spoonableAPI = new SpoonableAPI();

// Example: Find recipes by ingredients
try {
const recipeMap = await spoonableAPI.findRecipeByIngredients(["tomato", "onion", "spinach", "ranch", "cheese"]);
console.log("Recipe Map:", recipeMap);
} catch (error) {
console.error("Error finding recipes by ingredients:", error);
}

// Example: Get recipe by ID
try {
const recipe = await spoonableAPI.getRecipe(12345);
console.log("Recipe:", recipe);
} catch (error) {
console.error("Error getting recipe by ID:", error);
}
}
}

// Run the driver
Driver.run();
13 changes: 13 additions & 0 deletions API/Ingredient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Ingredient {
constructor(name, amount, unit) {
this.name = name;
this.amount = amount;
this.unit = unit;
}

toString() {
return `${this.amount} ${this.unit} of ${this.name}`;
}
}

module.exports = Ingredient;
60 changes: 60 additions & 0 deletions API/Recipe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
const Ingredient = require('./Ingredient');

class Recipe {
constructor(json) {
try {
const jsonObject = json;

// Extracting title
this.title = jsonObject.title;

this.sourceURL = jsonObject.sourceUrl;

// Extracting id
this.id = jsonObject.id;

// Extracting ingredients
const ingredientsArray = jsonObject.extendedIngredients;
this.ingredients = [];
for (const obj of ingredientsArray) {
const { nameClean: name, amount, unit } = obj;
this.ingredients.push(new Ingredient(name, amount, unit));
}

// Extracting instructions
const analyzedInstructions = jsonObject.analyzedInstructions;
this.instructions = [];
for (const instructionObj of analyzedInstructions) {
const steps = instructionObj.steps;
for (const stepObj of steps) {
const { step } = stepObj;
this.instructions.push(step);
}
}
} catch (error) {
console.error(error);
}
}

print() {
console.log(this.title);
console.log();
console.log(this.sourceURL);
console.log();
console.log("Ingredients:");
for (const ingredient of this.ingredients) {
console.log(ingredient.toString());
}
console.log();
console.log("Instructions:");
for (const instruction of this.instructions) {
console.log(instruction);
}
}
}

module.exports = Recipe;
// Example usage:



96 changes: 96 additions & 0 deletions API/SpoonableAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
const fetch = require('node-fetch-npm');
const Recipe = require('./Recipe');

class SpoonableAPI {
constructor() {
this.api_key = "4f8dacc258c84b57be1e22d613b58736";
this.name = "https://api.spoonacular.com/";
}

async findRecipeByIngredients(ingredients) {
const url = `${this.name}recipes/findByIngredients?ingredients=${ingredients.join(",+")}&number=2&apiKey=${this.api_key}`;
const filePath = "recipes.json";

try {
const response = await fetch(url);
const data = await response.json();


const recipeMap = {};
data.forEach(recipe => {
recipeMap[recipe.title] = recipe.id;
});

return recipeMap;
} catch (error) {
console.error(error);
return {};
}
}

async getRecipeInfo(id) {
const finalUrl = `${this.name}recipes/${id}/information?includeNutrition=false&addWinePairing=false&addTasteData=false&apiKey=${this.api_key}`;

console.log('Fetching recipe information from:', finalUrl);

try {
const response = await fetch(finalUrl);

if (!response.ok) {
throw new Error('Failed to fetch recipe information');
}

const data = await response.json();


// Create Recipe object
const recipe = new Recipe(data);

return recipe;
} catch (error) {
console.error('Error fetching recipe information:', error);
return null; // Return null or any other appropriate value to indicate failure
}
}

async searchRecipe(query) {
const url = `${this.name}recipes/complexSearch?query=${query}&maxFat=25&number=2&apiKey=${this.api_key}`;

try {
const response = await fetch(url);
const data = await response.json();


const recipeMap = {};
data.results.forEach(recipe => {
recipeMap[recipe.title] = recipe.id;
});

return recipeMap;
} catch (error) {
console.error(error);
return {};
}
}


}

module.exports = SpoonableAPI;

// Example usage
const spoonableAPI = new SpoonableAPI();
spoonableAPI.findRecipeByIngredients(["apple", "banana"]).then(recipeMap => {
console.log(recipeMap);
});

spoonableAPI.searchRecipe("pasta").then(recipeMap => {
console.log(recipeMap);
});


spoonableAPI.getRecipeInfo(638604).then(recipe => {
recipe.print();
});


1 change: 1 addition & 0 deletions API/t
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading