From ac1ece6e15b9cde804ecbe67f146456e5c532a34 Mon Sep 17 00:00:00 2001 From: Thibaud Dupuis <124290694+ThibaudDps@users.noreply.github.com> Date: Thu, 30 Nov 2023 17:27:44 +0100 Subject: [PATCH 01/10] init --- backend/database/schema.sql | 68 +++++++++++++++++++++++++++++++++++-- backend/package-lock.json | 35 +++++++++++++++++++ backend/package.json | 1 + backend/src/app.js | 4 +-- 4 files changed, 103 insertions(+), 5 deletions(-) diff --git a/backend/database/schema.sql b/backend/database/schema.sql index d7542a2f..09d5d5d8 100644 --- a/backend/database/schema.sql +++ b/backend/database/schema.sql @@ -1,4 +1,68 @@ -create table item ( + +create table pkmn_type ( id int unsigned primary key auto_increment not null, - title varchar(255) not null + name varchar(50) not null, + image varchar(255) not null ); + +create table pokemon ( + id int unsigned primary key auto_increment not null, + name varchar(50) not null, + description varchar(255) not null, + image varchar(255) not null +); + +ALTER TABLE pokemon +ADD COLUMN pkmn_type_id INTEGER, +ADD CONSTRAINT fk_type_id FOREIGN KEY (pkmn_type_id) REFERENCES pkmn_type(id); + +INSERT INTO pkmn_type (id, name, image) VALUES +(1, 'Grass', 'http://www.rw-designer.com/icon-view/21171.png'), +(2, 'Fire', 'http://www.rw-designer.com/icon-view/21169.png'), +(3, 'Water', 'http://www.rw-designer.com/icon-view/21170.png'), +(4, 'Bug', 'http://www.rw-designer.com/icon-view/21178.png'), +(5, 'Normal', 'http://www.rw-designer.com/icon-view/21168.png'), +(6, 'Flying', 'http://www.rw-designer.com/icon-view/21175.png'), +(7, 'Poison', 'http://www.rw-designer.com/icon-view/21183.png'), +(8, 'Electric', 'http://www.rw-designer.com/icon-view/21179.png'), +(9, 'Ground', 'http://www.rw-designer.com/icon-view/21172.png'), +(10, 'Psychic', 'http://www.rw-designer.com/icon-view/21185.png'), +(11, 'Fighting', 'http://www.rw-designer.com/icon-view/21181.png'), +(12, 'Rock', 'http://www.rw-designer.com/icon-view/21174.png'), +(13, 'Ghost', 'http://www.rw-designer.com/icon-view/21187.png'), +(14, 'Ice', 'http://www.rw-designer.com/icon-view/21176.png'), +(15, 'Dragon', 'http://www.rw-designer.com/icon-view/21189.png'), +(16, 'Steel', 'http://www.rw-designer.com/icon-view/21180.png'), +(17, 'Dark', 'http://www.rw-designer.com/icon-view/21184.png'), +(18, 'Fairy', 'http://www.rw-designer.com/icon-view/21188.png'); + + + INSERT INTO pokemon (id, name, description, image) VALUES +(1, 'Bulbasaur', 'A grass/poison-type Pokémon with a plant bulb on its back.', 'https://archives.bulbagarden.net/media/upload/thumb/f/fb/0001Bulbasaur.png/70px-0001Bulbasaur.png'), +(2, 'Ivysaur', 'The evolved form of Bulbasaur with a larger plant bulb.', 'https://archives.bulbagarden.net/media/upload/thumb/8/81/0002Ivysaur.png/70px-0002Ivysaur.png'), +(3, 'Venusaur', 'The final evolution of Bulbasaur with a large flower on its back.', 'https://archives.bulbagarden.net/media/upload/thumb/6/6b/0003Venusaur.png/70px-0003Venusaur.png'), +(4, 'Charmander', 'A fire-type Pokémon with a flame on its tail.', 'https://archives.bulbagarden.net/media/upload/thumb/2/27/0004Charmander.png/70px-0004Charmander.png'), +(5, 'Charmeleon', 'The evolved form of Charmander with a larger flame.', 'https://archives.bulbagarden.net/media/upload/thumb/0/05/0005Charmeleon.png/70px-0005Charmeleon.png'), +(6, 'Charizard', 'The final evolution of Charmander with powerful fire attacks.', 'https://archives.bulbagarden.net/media/upload/thumb/3/38/0006Charizard.png/70px-0006Charizard.png'), +(7, 'Squirtle', 'A water-type Pokémon with a shell on its back.', 'https://archives.bulbagarden.net/media/upload/thumb/5/54/0007Squirtle.png/70px-0007Squirtle.png'), +(8, 'Wartortle', 'The evolved form of Squirtle with a larger shell.', 'https://archives.bulbagarden.net/media/upload/thumb/0/0f/0008Wartortle.png/70px-0008Wartortle.png'), +(9, 'Blastoise', 'The final evolution of Squirtle with powerful water cannons on its shell.', 'https://archives.bulbagarden.net/media/upload/thumb/0/0a/0009Blastoise.png/70px-0009Blastoise.png'), +(10, 'Caterpie', 'A bug-type Pokémon with a voracious appetite for leaves.', 'https://archives.bulbagarden.net/media/upload/thumb/5/5e/0010Caterpie.png/70px-0010Caterpie.png'), +(11, 'Metapod', 'The evolved form of Caterpie, undergoing metamorphosis.', 'https://archives.bulbagarden.net/media/upload/thumb/d/da/0011Metapod.png/70px-0011Metapod.png'), +(12, 'Butterfree', 'The final evolution of Caterpie, a graceful butterfly with powdery wings.', 'https://archives.bulbagarden.net/media/upload/thumb/5/55/0012Butterfree.png/70px-0012Butterfree.png'), +(13, 'Weedle', 'A bug/poison-type Pokémon with a sharp stinger on its head.', 'https://archives.bulbagarden.net/media/upload/thumb/3/36/0013Weedle.png/70px-0013Weedle.png'), +(14, 'Kakuna', 'The evolved form of Weedle, hardening its shell for protection.', 'https://archives.bulbagarden.net/media/upload/thumb/f/f3/0014Kakuna.png/70px-0014Kakuna.png'), +(15, 'Beedrill', 'The final evolution of Weedle, a menacing Pokémon with poison stingers.', 'https://archives.bulbagarden.net/media/upload/thumb/f/f7/0015Beedrill.png/70px-0015Beedrill.png'), +(16, 'Pidgey', 'A normal/flying-type Pokémon with a keen eye and excellent flying abilities.', 'https://archives.bulbagarden.net/media/upload/thumb/0/0c/0016Pidgey.png/70px-0016Pidgey.png'), +(17, 'Pidgeotto', 'The evolved form of Pidgey, a bird with larger wings and more powerful attacks.', 'https://archives.bulbagarden.net/media/upload/thumb/8/82/0017Pidgeotto.png/70px-0017Pidgeotto.png'), +(18, 'Pidgeot', 'The final evolution of Pidgey, a majestic bird with impressive wingspan.', 'https://archives.bulbagarden.net/media/upload/thumb/7/73/0018Pidgeot.png/70px-0018Pidgeot.png'), +(19, 'Rattata', 'A normal-type Pokémon known for its speed and agility.', 'https://archives.bulbagarden.net/media/upload/thumb/a/aa/0019Rattata.png/70px-0019Rattata.png'), +(20, 'Raticate', 'The evolved form of Rattata, a fast and aggressive rodent Pokémon.', 'https://archives.bulbagarden.net/media/upload/thumb/2/2c/0020Raticate.png/70px-0020Raticate.png'), +(21, 'Spearow', 'A normal/flying-type Pokémon with a sharp beak for hunting.', 'https://archives.bulbagarden.net/media/upload/thumb/2/2d/0021Spearow.png/70px-0021Spearow.png'), +(22, 'Fearow', 'The evolved form of Spearow, a large bird with powerful beak attacks.', 'https://archives.bulbagarden.net/media/upload/thumb/9/92/0022Fearow.png/70px-0022Fearow.png'), +(23, 'Ekans', 'A poison-type Pokémon with a serpentine appearance.', 'https://archives.bulbagarden.net/media/upload/thumb/d/d2/0023Ekans.png/70px-0023Ekans.png'), +(24, 'Arbok', 'The evolved form of Ekans, a large cobra Pokémon with a hood.', 'https://archives.bulbagarden.net/media/upload/thumb/5/51/0024Arbok.png/70px-0024Arbok.png'), +(25, 'Pikachu', 'An electric-type Pokémon with yellow fur.', 'https://archives.bulbagarden.net/media/upload/thumb/4/4a/0025Pikachu.png/70px-0025Pikachu.png'), +(26, 'Raichu', 'The evolved form of Pikachu, an electric Pokémon with enhanced power.', 'https://archives.bulbagarden.net/media/upload/thumb/b/b0/0026Raichu.png/70px-0026Raichu.png'); + +UPDATE pokemon SET type_id = 1 WHERE id IN (1, 2, 3); \ No newline at end of file diff --git a/backend/package-lock.json b/backend/package-lock.json index 996593d9..97820bf0 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -5,6 +5,7 @@ "packages": { "": { "dependencies": { + "cors": "^2.8.5", "dotenv": "^16.3.1", "express": "^4.18.2", "mysql2": "^3.5.2" @@ -2203,6 +2204,18 @@ "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", "dev": true }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/create-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", @@ -5375,6 +5388,14 @@ "node": ">=8" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-inspect": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", @@ -8785,6 +8806,15 @@ "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", "dev": true }, + "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" + } + }, "create-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", @@ -11120,6 +11150,11 @@ "path-key": "^3.0.0" } }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + }, "object-inspect": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", diff --git a/backend/package.json b/backend/package.json index 292e378f..0adab400 100644 --- a/backend/package.json +++ b/backend/package.json @@ -8,6 +8,7 @@ "test": "jest" }, "dependencies": { + "cors": "^2.8.5", "dotenv": "^16.3.1", "express": "^4.18.2", "mysql2": "^3.5.2" diff --git a/backend/src/app.js b/backend/src/app.js index 22be9ab9..e9c4310a 100644 --- a/backend/src/app.js +++ b/backend/src/app.js @@ -25,7 +25,6 @@ const app = express(); // 4. Be sure to only have URLs in the array with domains from which you want to allow requests. // For example: ["http://mysite.com", "http://another-domain.com"] -/* const cors = require("cors"); app.use( @@ -34,10 +33,9 @@ app.use( process.env.FRONTEND_URL, // keep this one, after checking the value in `backend/.env` "http://mysite.com", "http://another-domain.com", - ] + ], }) ); -*/ /* ************************************************************************* */ From 945e4895adf34e3ed39df50a512f64f8dc53b273 Mon Sep 17 00:00:00 2001 From: Thibaud Dupuis <124290694+ThibaudDps@users.noreply.github.com> Date: Thu, 30 Nov 2023 17:30:58 +0100 Subject: [PATCH 02/10] init --- backend/database/schema.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/database/schema.sql b/backend/database/schema.sql index 09d5d5d8..6a663f16 100644 --- a/backend/database/schema.sql +++ b/backend/database/schema.sql @@ -65,4 +65,4 @@ INSERT INTO pkmn_type (id, name, image) VALUES (25, 'Pikachu', 'An electric-type Pokémon with yellow fur.', 'https://archives.bulbagarden.net/media/upload/thumb/4/4a/0025Pikachu.png/70px-0025Pikachu.png'), (26, 'Raichu', 'The evolved form of Pikachu, an electric Pokémon with enhanced power.', 'https://archives.bulbagarden.net/media/upload/thumb/b/b0/0026Raichu.png/70px-0026Raichu.png'); -UPDATE pokemon SET type_id = 1 WHERE id IN (1, 2, 3); \ No newline at end of file +UPDATE pokemon SET pkmn_type_id = 1 WHERE id IN (1, 2, 3); \ No newline at end of file From 406559f5e4bd488548f9265d3f24d06d95c3bf84 Mon Sep 17 00:00:00 2001 From: Thibaud Dupuis <124290694+ThibaudDps@users.noreply.github.com> Date: Fri, 1 Dec 2023 00:31:12 +0100 Subject: [PATCH 03/10] css + route + ajout footer + pages --- backend/database/schema.sql | 54 +++--- backend/package-lock.json | 69 ++++++-- backend/package.json | 1 + ...{itemControllers.js => pkmnControllers.js} | 30 ++-- backend/src/models/ItemManager.js | 30 ++-- backend/src/router.js | 16 +- frontend/index.html | 8 +- frontend/package-lock.json | 154 +++++++++++++++++- frontend/package.json | 3 +- frontend/src/App.css | 35 ++-- frontend/src/App.jsx | 42 +---- frontend/src/assets/favicon.svg | 15 -- frontend/src/assets/favimon.svg | 1 + frontend/src/assets/logo.svg | 7 - frontend/src/assets/logomon.svg | 9 + frontend/src/components/CardPkmn.jsx | 30 ++++ frontend/src/components/Counter.jsx | 16 -- frontend/src/components/Footer.jsx | 9 + frontend/src/components/Navbar.jsx | 7 + frontend/src/main.jsx | 23 ++- frontend/src/pages/AllPkmns.jsx | 7 + frontend/src/pages/Home.jsx | 20 +++ frontend/src/pages/PkmnPage.jsx | 7 + frontend/src/style/CardPkmn.css | 28 ++++ frontend/src/style/Footer.css | 14 ++ 25 files changed, 459 insertions(+), 176 deletions(-) rename backend/src/controllers/{itemControllers.js => pkmnControllers.js} (61%) delete mode 100644 frontend/src/assets/favicon.svg create mode 100644 frontend/src/assets/favimon.svg delete mode 100644 frontend/src/assets/logo.svg create mode 100644 frontend/src/assets/logomon.svg create mode 100644 frontend/src/components/CardPkmn.jsx delete mode 100644 frontend/src/components/Counter.jsx create mode 100644 frontend/src/components/Footer.jsx create mode 100644 frontend/src/components/Navbar.jsx create mode 100644 frontend/src/pages/AllPkmns.jsx create mode 100644 frontend/src/pages/Home.jsx create mode 100644 frontend/src/pages/PkmnPage.jsx create mode 100644 frontend/src/style/CardPkmn.css create mode 100644 frontend/src/style/Footer.css diff --git a/backend/database/schema.sql b/backend/database/schema.sql index 6a663f16..8d319127 100644 --- a/backend/database/schema.sql +++ b/backend/database/schema.sql @@ -38,31 +38,31 @@ INSERT INTO pkmn_type (id, name, image) VALUES INSERT INTO pokemon (id, name, description, image) VALUES -(1, 'Bulbasaur', 'A grass/poison-type Pokémon with a plant bulb on its back.', 'https://archives.bulbagarden.net/media/upload/thumb/f/fb/0001Bulbasaur.png/70px-0001Bulbasaur.png'), -(2, 'Ivysaur', 'The evolved form of Bulbasaur with a larger plant bulb.', 'https://archives.bulbagarden.net/media/upload/thumb/8/81/0002Ivysaur.png/70px-0002Ivysaur.png'), -(3, 'Venusaur', 'The final evolution of Bulbasaur with a large flower on its back.', 'https://archives.bulbagarden.net/media/upload/thumb/6/6b/0003Venusaur.png/70px-0003Venusaur.png'), -(4, 'Charmander', 'A fire-type Pokémon with a flame on its tail.', 'https://archives.bulbagarden.net/media/upload/thumb/2/27/0004Charmander.png/70px-0004Charmander.png'), -(5, 'Charmeleon', 'The evolved form of Charmander with a larger flame.', 'https://archives.bulbagarden.net/media/upload/thumb/0/05/0005Charmeleon.png/70px-0005Charmeleon.png'), -(6, 'Charizard', 'The final evolution of Charmander with powerful fire attacks.', 'https://archives.bulbagarden.net/media/upload/thumb/3/38/0006Charizard.png/70px-0006Charizard.png'), -(7, 'Squirtle', 'A water-type Pokémon with a shell on its back.', 'https://archives.bulbagarden.net/media/upload/thumb/5/54/0007Squirtle.png/70px-0007Squirtle.png'), -(8, 'Wartortle', 'The evolved form of Squirtle with a larger shell.', 'https://archives.bulbagarden.net/media/upload/thumb/0/0f/0008Wartortle.png/70px-0008Wartortle.png'), -(9, 'Blastoise', 'The final evolution of Squirtle with powerful water cannons on its shell.', 'https://archives.bulbagarden.net/media/upload/thumb/0/0a/0009Blastoise.png/70px-0009Blastoise.png'), -(10, 'Caterpie', 'A bug-type Pokémon with a voracious appetite for leaves.', 'https://archives.bulbagarden.net/media/upload/thumb/5/5e/0010Caterpie.png/70px-0010Caterpie.png'), -(11, 'Metapod', 'The evolved form of Caterpie, undergoing metamorphosis.', 'https://archives.bulbagarden.net/media/upload/thumb/d/da/0011Metapod.png/70px-0011Metapod.png'), -(12, 'Butterfree', 'The final evolution of Caterpie, a graceful butterfly with powdery wings.', 'https://archives.bulbagarden.net/media/upload/thumb/5/55/0012Butterfree.png/70px-0012Butterfree.png'), -(13, 'Weedle', 'A bug/poison-type Pokémon with a sharp stinger on its head.', 'https://archives.bulbagarden.net/media/upload/thumb/3/36/0013Weedle.png/70px-0013Weedle.png'), -(14, 'Kakuna', 'The evolved form of Weedle, hardening its shell for protection.', 'https://archives.bulbagarden.net/media/upload/thumb/f/f3/0014Kakuna.png/70px-0014Kakuna.png'), -(15, 'Beedrill', 'The final evolution of Weedle, a menacing Pokémon with poison stingers.', 'https://archives.bulbagarden.net/media/upload/thumb/f/f7/0015Beedrill.png/70px-0015Beedrill.png'), -(16, 'Pidgey', 'A normal/flying-type Pokémon with a keen eye and excellent flying abilities.', 'https://archives.bulbagarden.net/media/upload/thumb/0/0c/0016Pidgey.png/70px-0016Pidgey.png'), -(17, 'Pidgeotto', 'The evolved form of Pidgey, a bird with larger wings and more powerful attacks.', 'https://archives.bulbagarden.net/media/upload/thumb/8/82/0017Pidgeotto.png/70px-0017Pidgeotto.png'), -(18, 'Pidgeot', 'The final evolution of Pidgey, a majestic bird with impressive wingspan.', 'https://archives.bulbagarden.net/media/upload/thumb/7/73/0018Pidgeot.png/70px-0018Pidgeot.png'), -(19, 'Rattata', 'A normal-type Pokémon known for its speed and agility.', 'https://archives.bulbagarden.net/media/upload/thumb/a/aa/0019Rattata.png/70px-0019Rattata.png'), -(20, 'Raticate', 'The evolved form of Rattata, a fast and aggressive rodent Pokémon.', 'https://archives.bulbagarden.net/media/upload/thumb/2/2c/0020Raticate.png/70px-0020Raticate.png'), -(21, 'Spearow', 'A normal/flying-type Pokémon with a sharp beak for hunting.', 'https://archives.bulbagarden.net/media/upload/thumb/2/2d/0021Spearow.png/70px-0021Spearow.png'), -(22, 'Fearow', 'The evolved form of Spearow, a large bird with powerful beak attacks.', 'https://archives.bulbagarden.net/media/upload/thumb/9/92/0022Fearow.png/70px-0022Fearow.png'), -(23, 'Ekans', 'A poison-type Pokémon with a serpentine appearance.', 'https://archives.bulbagarden.net/media/upload/thumb/d/d2/0023Ekans.png/70px-0023Ekans.png'), -(24, 'Arbok', 'The evolved form of Ekans, a large cobra Pokémon with a hood.', 'https://archives.bulbagarden.net/media/upload/thumb/5/51/0024Arbok.png/70px-0024Arbok.png'), -(25, 'Pikachu', 'An electric-type Pokémon with yellow fur.', 'https://archives.bulbagarden.net/media/upload/thumb/4/4a/0025Pikachu.png/70px-0025Pikachu.png'), -(26, 'Raichu', 'The evolved form of Pikachu, an electric Pokémon with enhanced power.', 'https://archives.bulbagarden.net/media/upload/thumb/b/b0/0026Raichu.png/70px-0026Raichu.png'); - +(1, 'Bulbasaur', 'A grass/poison-type Pokémon with a plant bulb on its back.', 'https://archives.bulbagarden.net/media/upload/thumb/f/fb/0001Bulbasaur.png/600px-0001Bulbasaur.png'), +(2, 'Ivysaur', 'The evolved form of Bulbasaur with a larger plant bulb.', 'https://archives.bulbagarden.net/media/upload/8/81/0002Ivysaur.png'), +(3, 'Venusaur', 'The final evolution of Bulbasaur with a large flower on its back.', 'https://archives.bulbagarden.net/media/upload/thumb/6/6b/0003Venusaur.png/600px-0003Venusaur.png'), +(4, 'Charmander', 'A fire-type Pokémon with a flame on its tail.', 'https://archives.bulbagarden.net/media/upload/2/27/0004Charmander.png'), +(5, 'Charmeleon', 'The evolved form of Charmander with a larger flame.', 'https://archives.bulbagarden.net/media/upload/0/05/0005Charmeleon.png'), +(6, 'Charizard', 'The final evolution of Charmander with powerful fire attacks.', 'https://archives.bulbagarden.net/media/upload/thumb/3/38/0006Charizard.png/600px-0006Charizard.png'), +(7, 'Squirtle', 'A water-type Pokémon with a shell on its back.', 'https://archives.bulbagarden.net/media/upload/thumb/5/54/0007Squirtle.png/600px-0007Squirtle.png'), +(8, 'Wartortle', 'The evolved form of Squirtle with a larger shell.', 'https://archives.bulbagarden.net/media/upload/thumb/0/0f/0008Wartortle.png/600px-0008Wartortle.png'), +(9, 'Blastoise', 'The final evolution of Squirtle with powerful water cannons on its shell.', 'https://archives.bulbagarden.net/media/upload/thumb/0/0a/0009Blastoise.png/600px-0009Blastoise.png'), +(10, 'Caterpie', 'A bug-type Pokémon with a voracious appetite for leaves.', 'https://archives.bulbagarden.net/media/upload/thumb/5/5e/0010Caterpie.png/600px-0010Caterpie.png'), +(11, 'Metapod', 'The evolved form of Caterpie, undergoing metamorphosis.', 'https://archives.bulbagarden.net/media/upload/d/da/0011Metapod.png'), +(12, 'Butterfree', 'The final evolution of Caterpie, a graceful butterfly with powdery wings.', 'https://archives.bulbagarden.net/media/upload/thumb/5/55/0012Butterfree.png/600px-0012Butterfree.png'), +(13, 'Weedle', 'A bug/poison-type Pokémon with a sharp stinger on its head.', 'https://archives.bulbagarden.net/media/upload/thumb/3/36/0013Weedle.png/600px-0013Weedle.png'), +(14, 'Kakuna', 'The evolved form of Weedle, hardening its shell for protection.', 'https://archives.bulbagarden.net/media/upload/thumb/f/f3/0014Kakuna.png/600px-0014Kakuna.png'), +(15, 'Beedrill', 'The final evolution of Weedle, a menacing Pokémon with poison stingers.', 'https://archives.bulbagarden.net/media/upload/thumb/f/f7/0015Beedrill.png/600px-0015Beedrill.png'), +(16, 'Pidgey', 'A normal/flying-type Pokémon with a keen eye and excellent flying abilities.', 'https://archives.bulbagarden.net/media/upload/0/0c/0016Pidgey.png'), +(17, 'Pidgeotto', 'The evolved form of Pidgey, a bird with larger wings and more powerful attacks.', 'https://archives.bulbagarden.net/media/upload/thumb/8/82/0017Pidgeotto.png/600px-0017Pidgeotto.png'), +(18, 'Pidgeot', 'The final evolution of Pidgey, a majestic bird with impressive wingspan.', 'https://archives.bulbagarden.net/media/upload/thumb/7/73/0018Pidgeot.png/600px-0018Pidgeot.png'), +(19, 'Rattata', 'A normal-type Pokémon known for its speed and agility.', 'https://archives.bulbagarden.net/media/upload/thumb/a/aa/0019Rattata.png/600px-0019Rattata.png'), +(20, 'Raticate', 'The evolved form of Rattata, a fast and aggressive rodent Pokémon.', 'https://archives.bulbagarden.net/media/upload/thumb/2/2c/0020Raticate.png/600px-0020Raticate.png'), +(21, 'Spearow', 'A normal/flying-type Pokémon with a sharp beak for hunting.', 'https://archives.bulbagarden.net/media/upload/thumb/2/2d/0021Spearow.png/600px-0021Spearow.png'), +(22, 'Fearow', 'The evolved form of Spearow, a large bird with powerful beak attacks.', 'https://archives.bulbagarden.net/media/upload/thumb/9/92/0022Fearow.png/600px-0022Fearow.png'), +(23, 'Ekans', 'A poison-type Pokémon with a serpentine appearance.', 'https://archives.bulbagarden.net/media/upload/thumb/d/d2/0023Ekans.png/600px-0023Ekans.png'), +(24, 'Arbok', 'The evolved form of Ekans, a large cobra Pokémon with a hood.', 'https://archives.bulbagarden.net/media/upload/thumb/5/51/0024Arbok.png/600px-0024Arbok.png'), +(25, 'Pikachu', 'An electric-type Pokémon with yellow fur.', 'https://archives.bulbagarden.net/media/upload/thumb/4/4a/0025Pikachu.png/600px-0025Pikachu.png'), +(26, 'Raichu', 'The evolved form of Pikachu, an electric Pokémon with enhanced power.', 'https://archives.bulbagarden.net/media/upload/thumb/b/b0/0026Raichu.png/600px-0026Raichu.png'); +(27, 'Sandshrew', 'A ground-type Pokémon with tough sand-colored skin.', 'https://archives.bulbagarden.net/media/upload/thumb/e/e9/0027Sandshrew.png/600px-0027Sandshrew.png'); UPDATE pokemon SET pkmn_type_id = 1 WHERE id IN (1, 2, 3); \ No newline at end of file diff --git a/backend/package-lock.json b/backend/package-lock.json index 97820bf0..3c5e9ed3 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -5,6 +5,7 @@ "packages": { "": { "dependencies": { + "axios": "^1.6.2", "cors": "^2.8.5", "dotenv": "^16.3.1", "express": "^4.18.2", @@ -1657,8 +1658,7 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/available-typed-arrays": { "version": "1.0.5", @@ -1672,6 +1672,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/axios": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", + "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -2131,7 +2141,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -2487,7 +2496,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true, "engines": { "node": ">=0.4.0" } @@ -3322,6 +3330,25 @@ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, + "node_modules/follow-redirects": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -3335,7 +3362,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -5854,6 +5880,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/pstree.remy": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", @@ -8408,8 +8439,7 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "available-typed-arrays": { "version": "1.0.5", @@ -8417,6 +8447,16 @@ "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", "dev": true }, + "axios": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", + "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -8748,7 +8788,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -8988,8 +9027,7 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" }, "denque": { "version": "2.1.0", @@ -9639,6 +9677,11 @@ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, + "follow-redirects": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==" + }, "for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -9652,7 +9695,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -11479,6 +11521,11 @@ "ipaddr.js": "1.9.1" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "pstree.remy": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", diff --git a/backend/package.json b/backend/package.json index 0adab400..714bdc33 100644 --- a/backend/package.json +++ b/backend/package.json @@ -8,6 +8,7 @@ "test": "jest" }, "dependencies": { + "axios": "^1.6.2", "cors": "^2.8.5", "dotenv": "^16.3.1", "express": "^4.18.2", diff --git a/backend/src/controllers/itemControllers.js b/backend/src/controllers/pkmnControllers.js similarity index 61% rename from backend/src/controllers/itemControllers.js rename to backend/src/controllers/pkmnControllers.js index fca2dc2d..0695abed 100644 --- a/backend/src/controllers/itemControllers.js +++ b/backend/src/controllers/pkmnControllers.js @@ -4,11 +4,11 @@ const tables = require("../tables"); // The B of BREAD - Browse (Read All) operation const browse = async (req, res, next) => { try { - // Fetch all items from the database - const items = await tables.item.readAll(); + // Fetch all pokemons from the database + const pokemons = await tables.pokemon.readAll(); - // Respond with the items in JSON format - res.json(items); + // Respond with the pokemons in JSON format + res.json(pokemons); } catch (err) { // Pass any errors to the error-handling middleware next(err); @@ -18,15 +18,15 @@ const browse = async (req, res, next) => { // The R of BREAD - Read operation const read = async (req, res, next) => { try { - // Fetch a specific item from the database based on the provided ID - const item = await tables.item.read(req.params.id); + // Fetch a specific pokemon from the database based on the provided ID + const pokemon = await tables.pokemon.read(req.params.id); - // If the item is not found, respond with HTTP 404 (Not Found) - // Otherwise, respond with the item in JSON format - if (item == null) { + // If the pokemon is not found, respond with HTTP 404 (Not Found) + // Otherwise, respond with the pokemon in JSON format + if (pokemon == null) { res.sendStatus(404); } else { - res.json(item); + res.json(pokemon); } } catch (err) { // Pass any errors to the error-handling middleware @@ -39,14 +39,14 @@ const read = async (req, res, next) => { // The A of BREAD - Add (Create) operation const add = async (req, res, next) => { - // Extract the item data from the request body - const item = req.body; + // Extract the pokemon data from the request body + const pokemon = req.body; try { - // Insert the item into the database - const insertId = await tables.item.create(item); + // Insert the pokemon into the database + const insertId = await tables.pokemon.create(pokemon); - // Respond with HTTP 201 (Created) and the ID of the newly inserted item + // Respond with HTTP 201 (Created) and the ID of the newly inserted pokemon res.status(201).json({ insertId }); } catch (err) { // Pass any errors to the error-handling middleware diff --git a/backend/src/models/ItemManager.js b/backend/src/models/ItemManager.js index eeeae9f3..ce92cf11 100644 --- a/backend/src/models/ItemManager.js +++ b/backend/src/models/ItemManager.js @@ -1,59 +1,59 @@ const AbstractManager = require("./AbstractManager"); -class ItemManager extends AbstractManager { +class pokemonManager extends AbstractManager { constructor() { // Call the constructor of the parent class (AbstractManager) - // and pass the table name "item" as configuration - super({ table: "item" }); + // and pass the table name "pokemon" as configuration + super({ table: "pokemon" }); } // The C of CRUD - Create operation - async create(item) { - // Execute the SQL INSERT query to add a new item to the "item" table + async create(pokemon) { + // Execute the SQL INSERT query to add a new pokemon to the "pokemon" table const [result] = await this.database.query( `insert into ${this.table} (title) values (?)`, - [item.title] + [pokemon.name] ); - // Return the ID of the newly inserted item + // Return the ID of the newly inserted pokemon return result.insertId; } // The Rs of CRUD - Read operations async read(id) { - // Execute the SQL SELECT query to retrieve a specific item by its ID + // Execute the SQL SELECT query to retrieve a specific pokemon by its ID const [rows] = await this.database.query( `select * from ${this.table} where id = ?`, [id] ); - // Return the first row of the result, which represents the item + // Return the first row of the result, which represents the pokemon return rows[0]; } async readAll() { - // Execute the SQL SELECT query to retrieve all items from the "item" table + // Execute the SQL SELECT query to retrieve all pokemons from the "pokemon" table const [rows] = await this.database.query(`select * from ${this.table}`); - // Return the array of items + // Return the array of pokemons return rows; } // The U of CRUD - Update operation - // TODO: Implement the update operation to modify an existing item + // TODO: Implement the update operation to modify an existing pokemon - // async update(item) { + // async update(pokemon) { // ... // } // The D of CRUD - Delete operation - // TODO: Implement the delete operation to remove an item by its ID + // TODO: Implement the delete operation to remove an pokemon by its ID // async delete(id) { // ... // } } -module.exports = ItemManager; +module.exports = pokemonManager; diff --git a/backend/src/router.js b/backend/src/router.js index 38f375d7..de02f721 100644 --- a/backend/src/router.js +++ b/backend/src/router.js @@ -6,17 +6,17 @@ const router = express.Router(); // Define Your API Routes Here /* ************************************************************************* */ -// Import itemControllers module for handling item-related operations -const itemControllers = require("./controllers/itemControllers"); +// Import pkmnControllers module for handling pkmn-related operations +const pkmnControllers = require("./controllers/pkmnControllers"); -// Route to get a list of items -router.get("/items", itemControllers.browse); +// Route to get a list of pkmns +router.get("/pokemons", pkmnControllers.browse); -// Route to get a specific item by ID -router.get("/items/:id", itemControllers.read); +// Route to get a specific pkmn by ID +router.get("/pokemons/:id", pkmnControllers.read); -// Route to add a new item -router.post("/items", itemControllers.add); +// Route to add a new pkmn +router.post("/types", pkmnControllers.add); /* ************************************************************************* */ diff --git a/frontend/index.html b/frontend/index.html index fa61a372..7d2abe63 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -2,9 +2,13 @@ - + + - Vite App + Pokepédia v.1
diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 69fbe5f5..c14bcf9a 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -5,10 +5,11 @@ "packages": { "": { "dependencies": { + "axios": "^1.6.2", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-router-dom": "^6.14.2" + "react-router-dom": "^6.20.0" }, "devDependencies": { "@vitejs/plugin-react": "^4.0.3", @@ -1233,6 +1234,11 @@ "has-symbols": "^1.0.3" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "node_modules/available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", @@ -1254,6 +1260,16 @@ "node": ">=4" } }, + "node_modules/axios": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", + "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/axobject-query": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz", @@ -1431,6 +1447,17 @@ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1569,6 +1596,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -2435,6 +2470,25 @@ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, + "node_modules/follow-redirects": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -2444,6 +2498,19 @@ "is-callable": "^1.1.3" } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3374,6 +3441,25 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mimic-fn": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", @@ -3813,6 +3899,11 @@ "react-is": "^16.13.1" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -5615,6 +5706,11 @@ "has-symbols": "^1.0.3" } }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", @@ -5627,6 +5723,16 @@ "integrity": "sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==", "dev": true }, + "axios": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", + "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "axobject-query": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz", @@ -5746,6 +5852,14 @@ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -5846,6 +5960,11 @@ "object-keys": "^1.1.1" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -6507,6 +6626,11 @@ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, + "follow-redirects": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==" + }, "for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -6516,6 +6640,16 @@ "is-callable": "^1.1.3" } }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -7159,6 +7293,19 @@ "picomatch": "^2.3.1" } }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, "mimic-fn": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", @@ -7454,6 +7601,11 @@ "react-is": "^16.13.1" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index 9f85c669..29f607c7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,10 +5,11 @@ "preview": "vite preview" }, "dependencies": { + "axios": "^1.6.2", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-router-dom": "^6.14.2" + "react-router-dom": "^6.20.0" }, "devDependencies": { "@vitejs/plugin-react": "^4.0.3", diff --git a/frontend/src/App.css b/frontend/src/App.css index 115ca49b..cfc4d935 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -1,34 +1,31 @@ -body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", - "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", - sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; +:root::-webkit-scrollbar { + display: none; } -code { - font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", - monospace; +body { + margin: 0; + background-color: #282c34; + font-family: "Press Start 2P"; + font-size: 12px; } -.App { +.home { text-align: center; } -.App-logo { +.home-logo { height: 40vmin; pointer-events: none; } @media (prefers-reduced-motion: no-preference) { - .App-logo { + .home-logo { + width: 200px; animation: App-logo-spin infinite 20s linear; } } -.App-header { - background-color: #282c34; +.home-header { min-height: 100vh; display: flex; flex-direction: column; @@ -38,10 +35,6 @@ code { color: white; } -.App-link { - color: #61dafb; -} - @keyframes App-logo-spin { from { transform: rotate(0deg); @@ -50,7 +43,3 @@ code { transform: rotate(360deg); } } - -button { - font-size: calc(10px + 2vmin); -} diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index cde440f6..773cb051 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,41 +1,15 @@ -import Counter from "./components/Counter"; -import logo from "./assets/logo.svg"; +import { Outlet } from "react-router-dom"; -import "./App.css"; +import NavBar from "./components/Navbar"; +import Footer from "./components/Footer"; function App() { return ( -
-
- logo -

Hello Vite + React !

- - - -

- Edit App.jsx and save to test HMR updates. -

-

- - Learn React - - {" | "} - - Vite Docs - -

-
-
+ <> + + +