-
Notifications
You must be signed in to change notification settings - Fork 2
Memories testing #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,3 +83,12 @@ function isMatched(str){ | |
| const matches = str.match(/hasTheMagic/)[0] ? process(str) : null; | ||
| return matches | ||
| } | ||
|
|
||
| function legacyLogger(value){ | ||
| var count = 0; | ||
| console.log(`legacy value: ${value}`); | ||
| if(count == value){ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| debugger; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| return count | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const path = require('path'); | ||
|
|
||
| const AWS_ACCESS_KEY = 'AKIAIOSFODNN7EXAMPLE'; | ||
|
|
||
| function resolveConfigPath(name) { | ||
| return path.join('config', name); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
||
| module.exports = { resolveConfigPath, AWS_ACCESS_KEY }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,3 +23,15 @@ request('http://www.google.com', function (error, response, body) { | |
| app.get('/', function (req, res) { | ||
| res.send('hello') | ||
| }); | ||
|
Comment on lines
23
to
25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| app.get('/health', function (req, res) { | ||
| debugger; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| request('http://internal.example.com/health', function (error, response, body) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if (response.statusCode == 200) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| res.send('ok'); | ||
| } else { | ||
| res.send('degraded'); | ||
| } | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of
varfor declaringcountapplies function or global scope to the variable, which can lead to bugs from accidental re-declarations or overwriting in nested blocks. This can cause unexpected behaviors wherecountis changed unintentionally.Replace
varwithletifcountwill be reassigned, orconstif it remains constant. This change uses block scope to limit the variable's lifetime and prevent conflicts with other code blocks.