From 5e9d31bcf451029aaf82c13e65e46a56e0eedc52 Mon Sep 17 00:00:00 2001 From: SpringerJordan Date: Wed, 24 Feb 2021 17:55:31 -0500 Subject: [PATCH 1/2] first commit --- data/schema.sql | 163 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) diff --git a/data/schema.sql b/data/schema.sql index e69de29..5b0364e 100644 --- a/data/schema.sql +++ b/data/schema.sql @@ -0,0 +1,163 @@ +DROP TABLE if exists pokemon_junction; +DROP TABLE if exists pokemon_tbl; +create table if not exists pokemon_tbl( + pokemon_id INT NOT NULL PRIMARY KEY, + pokemon_sprite VARCHAR(1000), + pokemon_name VARCHAR(100) NOT NULL +); + +DROP TABLE if exists pokemon_type; +create table if not exists pokemon_type( + pokemon_type_id INT NOT NULL PRIMARY KEY, + pokemon_type_name VARCHAR(40) NOT NULL +); + +create table if not exists pokemon_junction( + pokemon_id INT NOT NULL, + foreign key (pokemon_id)REFERENCES pokemon_tbl (pokemon_id), + pokemon_type_id INT NOT NULL, + foreign key (pokemon_type_id) REFERENCES pokemon_type (pokemon_type_id), + pokemon_junction_id VARCHAR(40) NOT NULL PRIMARY KEY +); + + + +-- POKEMON TABLE-- +INSERT INTO pokemon_tbl ( + pokemon_id, + pokemon_sprite, + pokemon_name + ) + VALUES ( + "1", + "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-i/yellow/1.png" , + "Bulbasaur" + ); + INSERT INTO pokemon_tbl ( + pokemon_id, + pokemon_sprite, + pokemon_name + ) + VALUES ( + "2", + null , + "Ivysaur" + ); + + INSERT INTO pokemon_tbl ( + pokemon_id, + pokemon_sprite, + pokemon_name + ) + VALUES ( + "3", + null , + "Venasaur" + ); + + INSERT INTO pokemon_tbl ( + pokemon_id, + pokemon_sprite, + pokemon_name + ) + VALUES ( + "4", + null , + "Charmander" + ); + INSERT INTO pokemon_tbl ( + pokemon_id, + pokemon_sprite, + pokemon_name + ) + VALUES ( + "5", + null , + "Charmeleon" + ); + INSERT INTO pokemon_tbl ( + pokemon_id, + pokemon_sprite, + pokemon_name + ) + VALUES ( + "6", + null , + "Charizard" + ); + INSERT INTO pokemon_tbl ( + pokemon_id, + pokemon_sprite, + pokemon_name + ) + VALUES ( + "7", + null , + "Squirtle" + ); + + + -- TYPES TABLE -- + + INSERT INTO pokemon_type( + pokemon_type_id, + pokemon_type_name + ) + VALUES ( + 1, + "Grass" + ); + + INSERT INTO pokemon_type( + pokemon_type_id, + pokemon_type_name + ) + VALUES ( + 2, + "Fire" + ); + + INSERT INTO pokemon_type( + pokemon_type_id, + pokemon_type_name + ) + VALUES ( + 3, + "Water" + ); + + INSERT INTO pokemon_type( + pokemon_type_id, + pokemon_type_name + ) + VALUES ( + 4, + "Poison" + ); + + INSERT INTO pokemon_type( + pokemon_type_id, + pokemon_type_name + ) + VALUES ( + 5, + "Flying" + ); + + INSERT INTO pokemon_type( + pokemon_type_id, + pokemon_type_name + ) + VALUES ( + 1, + "Grass" + ); + + + + + + + -- END TYPES TABLE -- +-- SELECT * FROM pokemon_tbl; +SELECT * FROM pokemon_type; \ No newline at end of file From 020d5af1b9ed8c1acb659199e8c8b03c2027b842 Mon Sep 17 00:00:00 2001 From: SpringerJordan Date: Wed, 3 Mar 2021 20:28:19 -0500 Subject: [PATCH 2/2] first commit --- .DS_Store | Bin 0 -> 8196 bytes data/schema.sql | 194 ++++++++-------------------------------------- index.js | 11 --- package-lock.json | 28 +++++-- package.json | 1 + rest/app.js | 58 ++++++++++++++ rest/index.js | 11 --- web/.DS_Store | Bin 0 -> 6148 bytes web/index.html | 20 ++++- web/styles.css | 135 ++++++++++++++++++++++++++++++++ 10 files changed, 262 insertions(+), 196 deletions(-) create mode 100644 .DS_Store delete mode 100644 index.js create mode 100644 rest/app.js delete mode 100644 rest/index.js create mode 100644 web/.DS_Store create mode 100644 web/styles.css diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..78f5f9e4a10b433929f6d26351a4fc3931e2d208 GIT binary patch literal 8196 zcmeHMPfrs;6n_I%wweNiHQkFD8_#WW2q2BjDb)BC8Bk=UFym*Q+KyisF>dU z07gx`_yIim0raK^uO2=41-y9hq;LMTwu>a5z{pH8^LsP%-n^aP&b;Ln03hjdAqg-5 z00vf$=0R-!Q20ErTS}W6F%b#c!<5JJw#RJj^D$jC1DXNNfM!55pc(l07{G5fFUB_C zeL1UJ&46ZLPcp#cLjo(ul){=s5jwCDDF9*&hebhI{OOOF-~)&$g*Aydf`v#^L}^M? zia}K7K%_a&r<8t8qBI90JmWgbGf^1|QHcjh2z4MSiMrJcXa=@2z^_XT3SdD9RwREP z$GMT8q6ou=o?Qt_D$oCDmpnHJM@K)Cw)WV*{Ra%A!|3SjxRbfhDw)s<%R$=mZ}Z-a z72da%Jja;VkS%-Obt*Zt_d27Yt7*32Olbged>gD8>;l#!Bqnn#?qyJ3u>eRi}^^NM|%_lG9=7|a*&?Wng_9aS< z9j;}3>M>fxF|Hp27gnJNL4=_XOfqE3#bl?$;z=NnhITg`AgxXB#=Wu;4mBB;n zh#z71s_9L1LkZtl9#*g|qW(FwVxlj+qD)(#lsw(yxpjr@?0!V-;xG%7Fb)%N3vmRW zy3p#WjdRw_Neq0xBM4jda1DUwJvH?Hh@7r=s31djgdcvkn)y*$P3(Nw?YlQn zt&W}li>vn>w}NHctH-aV+Mb(VQ=x^tuW#>*Y1V^FyyM`Z&cj`1ch8aT-tNA>zN7tp z13kx2 { + if (err) { + throw err; + } + con.query(“SELECT * FROM pokemon”, (err, result, fields) => { + if (err) { + throw err; + } + console.log(result); + }); +}); +let pokemon_id = 1; +let name = “Bulbasaur”; +let color = “Green”; +//console.log(`INSERT into pokemon (pokemon_id, name, color) VALUES (${pokemon_id}, ${name}, ${color});`); +con.query(`INSERT into pokemon (pokemon_id, name, color) VALUES (${pokemon_id}, ${name}, ${color});`, (err, result, fields) => { + if (err) { + throw err; + } +}); +-- 9:00 +-- ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’; +-- 9:00 +-- FLUSH PRIVILEGES; diff --git a/index.js b/index.js deleted file mode 100644 index bba5463..0000000 --- a/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const express = require('express') -const app = express() -const port = 3000 - -app.get('/', (req, res) => { - res.send('Hello World!') -}) - -app.listen(port, () => { - console.log(`Example app listening at http://localhost:${port}`) -}) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1fca92a..2942519 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,6 +63,15 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -213,16 +222,16 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" }, "mime-db": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz", - "integrity": "sha512-CkqLUxUk15hofLoLyljJSrukZi8mAtgd+yE5uO4tqRZsdsAJKv0O+rFMhVDRJgozy+yG6md5KwuXhD4ocIoP+w==" + "version": "1.46.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", + "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==" }, "mime-types": { - "version": "2.1.28", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.28.tgz", - "integrity": "sha512-0TO2yJ5YHYr7M2zzT7gDU1tbwHxEUWBCLt0lscSNpcdAfFyJOVEpRYNS7EXVcTLNj/25QO8gulHC5JtTzSE2UQ==", + "version": "2.1.29", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", + "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", "requires": { - "mime-db": "1.45.0" + "mime-db": "1.46.0" } }, "ms": { @@ -235,6 +244,11 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", diff --git a/package.json b/package.json index 944e450..2d4824e 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ }, "homepage": "https://github.com/code-differently/Pokedex-App#readme", "dependencies": { + "cors": "^2.8.5", "express": "^4.17.1" } } diff --git a/rest/app.js b/rest/app.js new file mode 100644 index 0000000..131ebf9 --- /dev/null +++ b/rest/app.js @@ -0,0 +1,58 @@ +const express = require('express') +const app = express() +const port = 3000 + +app.get('/', (req, res) => { + res.send('Hello World!') +}) + +app.listen(port, () => { + console.log(`Example app listening at http://localhost:${port}`) +}) +console.log(hello); + +let pokedex = document.getElementById("pokedex"); +console.log(pokedex); +let url = "https://pokeapi.co/api/v2/pokemon/"; +let fetchPokemon = () => { + const promises = []; + for (let i = 1; i <= 139; i++, status == 200) { + // console.log(url + i); + + promises.push(fetch(url + i).then((res) => { + return res.json(); + + })); + } + + Promise.all(promises).then(results => { + const pokemon = results.map((data) => ({ + name: data.name, + id: data.id, + image: data.sprites['front_shiny'], + type: data.types[0].type.name + })); + displayPokemon(pokemon); + }); +}; +let thisPokemon; +let displayPokemon = (pokemon) => { + // console.log(pokemon.type); + const pokemonHTMLString = pokemon.map( + (pokeman) => ` +
+ +

${pokeman.id}. ${pokeman.name}

+

Type: ${pokeman.type}

+
+ `).join(''); + pokedex.innerHTML = pokemonHTMLString; + // return cardColor(); +}; +// card.classList.add('card', `${​​​​​pokeman.types[0].type.name}​​​​​`, 'font-weight-bold'); +function cardColor() { + if (pokeman.type === 'grass') { + document.getElementsByClassName("card")[0].style.backgroundColor = "blue"; + } +}; +fetchPokemon(); \ No newline at end of file diff --git a/rest/index.js b/rest/index.js deleted file mode 100644 index bba5463..0000000 --- a/rest/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const express = require('express') -const app = express() -const port = 3000 - -app.get('/', (req, res) => { - res.send('Hello World!') -}) - -app.listen(port, () => { - console.log(`Example app listening at http://localhost:${port}`) -}) \ No newline at end of file diff --git a/web/.DS_Store b/web/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a308495be0b3e8dafa0e7c3f0fd215e577ad4fa8 GIT binary patch literal 6148 zcmeHKyG{c^3>-s>2%40X`vsBsgCzhBZIJ;4K>u*Kb1 z{?)L%-3+@8&;7?;(3kIFT*;(>6p#W^Knh5K-zwm}mo`65RFnczKni>+;NOQvckG2@ zVthInVgw-0m=5DQW(i{R1hE&6iOkR}sl=pOjTn}6=3CYE!Z9)Fu(+Aeshh1P6pP!L zZ&42GiHcG{3LGkMoZE%>|4aH0^Zy}9J1HOq{*?kYTVJnNe5LBGlb7>e+vqoRuX&@p qaUB$fXvf58$J}^3K8vEPYrf`rFB}tt&V0~``ZM6V$fUquEARmx#2bwO literal 0 HcmV?d00001 diff --git a/web/index.html b/web/index.html index 1de928b..d7776eb 100644 --- a/web/index.html +++ b/web/index.html @@ -1,11 +1,23 @@ + - - - Document + + JAF's Pokedex + + + -

Hello Pokemon!

+
+

JAF's Pokedex

+

Gotta catch'em all!

+
+ +
+ + \ No newline at end of file diff --git a/web/styles.css b/web/styles.css new file mode 100644 index 0000000..ca5f630 --- /dev/null +++ b/web/styles.css @@ -0,0 +1,135 @@ +/*PokedexJAF.css*/ +/* testiing testing testing */ +body { + background-color: orangered; + color: white; + margin: 0; + font-family: rubik; + } + + .container { + padding: 40px; + margin: 0 auto; + } + + h1 { + text-transform: uppercase; + text-align: center; + font-size: 20px; + font-style: pokemon; + } + h2{ + font-style: andybold; + text-align: center; + } + + /* pokedex { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); + grid-gap: 20px; + padding-inline-start: 0; + } */ + + .card { + height: 200px; + width: 180px; + list-style: none; + padding: 40px; + background-color: #f4f4f4; + color: #222; + text-align: center; + display: inline-block; + margin: 1%; + } + + .card:hover { + animation: bounce 0.5s linear; + } + + .card-title { + text-transform: capitalize; + margin-bottom: 0px; + font-size: 32px; + font-weight: normal; + } + .card-subtitle { + margin-top: 5px; + color: #666; + font-weight: lighter; + } + + .card-image { + height: 180px; + } + /* text wrap */ + .fire { + background-color: firebrick; + } + + .bug { + background-color: greenyellow; + } + + .grass { + background-color: green; + } + + .water { + background-color: aqua; + } + + .normal { + background-color: burlywood; + } + + .electric { + background-color: yellow; + } + + .poison { + background-color: slateblue; + } + + .ground { + background-color: chocolate; + } + + .fairy { + background-color: pink; + } + + .psychic { + background-color: rebeccapurple; + } + + .rock { + background-color: grey; + } + + .fighting { + background-color: crimson; + } + + .ghost { + background-color: darkmagenta; + } + + .ice { + background-color: darkturquoise; + } + + .dragon { + background-color: olive; + } + + .steel { + background-color: steelblue; + } + + .dark { + background-color: darkslategrey; + } + + .flying { + background-color: lightskyblue; + } \ No newline at end of file