Skip to content

Successfully connect to my Pokemon database #18

Open
lnguyen135 wants to merge 2 commits intocode-differently:mainfrom
lnguyen135:main
Open

Successfully connect to my Pokemon database #18
lnguyen135 wants to merge 2 commits intocode-differently:mainfrom
lnguyen135:main

Conversation

@lnguyen135
Copy link
Copy Markdown

Please review

@@ -0,0 +1,46 @@
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Lakewoods135';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change your password :)

types_ID INT NOT NULL,
FOREIGN KEY (types_ID) REFERENCES Types (types_ID)
);
INSERT INTO POKEMON_Card (Pokemon_ID, Pokemon_Type, Pokemon_Name, Pokemon_Color) VALUES (1, 'Grass', 'BLue', 'Blueberry'); No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you have the same code twice, you only need the three tables

throw err;
}
console.log(result);
app.get('/Pokedex', async (req, res) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The connection logic should go inside the app.get route, that way when the route is requested, you call your database connection logic, read from the database, and respond with the data

let PokemonColor = document.getElementById('Color');


fetch('http://localhost:33600/Pokedex')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your server's port is 3360, you have 33600 in your fetch statement

PokemonType.innerHTML = `Type: ` + res[0].Pokemon_Type;
PokemonName.innerHTML = `Name:` + res[0].Pokemon_Name;
PokemonColor.innerHTML = `Color:` + res[0].Pokemon_Color;
console.log(res);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works perfectly for one pokemon, the next step is to make it work for multiple

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants