Successfully connect to my Pokemon database #18
Open
lnguyen135 wants to merge 2 commits intocode-differently:mainfrom
Open
Successfully connect to my Pokemon database #18lnguyen135 wants to merge 2 commits intocode-differently:mainfrom
lnguyen135 wants to merge 2 commits intocode-differently:mainfrom
Conversation
kburd
reviewed
Mar 15, 2021
| @@ -0,0 +1,46 @@ | |||
| ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Lakewoods135'; | |||
| 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 |
Contributor
There was a problem hiding this comment.
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) => { |
Contributor
There was a problem hiding this comment.
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') |
Contributor
There was a problem hiding this comment.
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); |
Contributor
There was a problem hiding this comment.
This works perfectly for one pokemon, the next step is to make it work for multiple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please review