Mickey Haile | London-9 | Database | week 2 - #43
Conversation
| app.listener = app.listen(3000, function () { | ||
| console.log(`Server is listening on port ${3000}`); | ||
| }); |
There was a problem hiding this comment.
Normally this goes at the bottom as I think this is a blocking call, i.e. the rest of the code below it won't run - it's also a little jarring to see it at the top of the file from a convention standpoint.
| user: "mickeyhaile", // replace with you username | ||
| host: "localhost", | ||
| database: "cyf_ecommerce", | ||
| password: "", |
There was a problem hiding this comment.
I don't see where you use env vars to add this in? You should have process.env.DB_PASSWORD or something somewhere here.
| (error, result) => { | ||
| if (error) { | ||
| console.error(error); | ||
| res.status(500).json({ error: "Internal Server Error" }); |
There was a problem hiding this comment.
I like the error handling, however careful with this as not every error is a 500 error; it could be a bad request or invalid credentials or something like that.
JDysiewicz
left a comment
There was a problem hiding this comment.
Code looks good, although move the listener to the bottom of the file as it's conventional
|
Kudos, SonarCloud Quality Gate passed! |








Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.