Skip to content

Mickey Haile | London-9 | Database | week 2 - #43

Closed
mickeyhaile2 wants to merge 5 commits into
CodeYourFuture:mainfrom
mickeyhaile2:main
Closed

Mickey Haile | London-9 | Database | week 2#43
mickeyhaile2 wants to merge 5 commits into
CodeYourFuture:mainfrom
mickeyhaile2:main

Conversation

@mickeyhaile2

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@mickeyhaile2 mickeyhaile2 changed the title Mickey Haile | London-9 | Database | week 1 Mickey Haile | London-9 | Database | week 2 May 23, 2023
Comment thread E-Commerce-API/app.js Outdated
Comment on lines +8 to +10
app.listener = app.listen(3000, function () {
console.log(`Server is listening on port ${3000}`);
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread E-Commerce-API/app.js Outdated
user: "mickeyhaile", // replace with you username
host: "localhost",
database: "cyf_ecommerce",
password: "",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see where you use env vars to add this in? You should have process.env.DB_PASSWORD or something somewhere here.

Comment thread E-Commerce-API/app.js
Comment on lines +24 to +27
(error, result) => {
if (error) {
console.error(error);
res.status(500).json({ error: "Internal Server Error" });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 JDysiewicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks good, although move the listener to the bottom of the file as it's conventional

@sonarqubecloud

sonarqubecloud Bot commented Jun 2, 2023

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

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.

3 participants