-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
refactor(server): clean up lib/server.js #1873
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
Conversation
a60aff3
to
794ee09
Compare
Codecov Report
@@ Coverage Diff @@
## master #1873 +/- ##
==========================================
+ Coverage 87.85% 87.92% +0.07%
==========================================
Files 14 14
Lines 782 787 +5
Branches 256 259 +3
==========================================
+ Hits 687 692 +5
Misses 82 82
Partials 13 13
Continue to review full report at Codecov.
|
9a44971
to
8f571bd
Compare
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.
It is breaking change 😞 we can't rename/change/delete properties and method, because it is public api and can be used other developers. We should keep backward compatibility
You can send a PR with fixing lint problems and typos, it is not breaking change |
8f571bd
to
dd0b66a
Compare
I gave up changing property names. I'll change these when we release as semver-major:) |
fe4f67c
to
781525c
Compare
lib/Server.js
Outdated
for (const name in this.headers) { | ||
res.setHeader(name, this.headers[name]); | ||
} | ||
if (this.options.headers) { |
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.
Let's wait this too because developers can change this.headers
in runtime and it is break logic
} else { | ||
this.listeningApp = http.createServer(this.app); | ||
} | ||
} |
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.
I think we should rename this method on createServer
, also we can refactor this on two methods:
- setupHttps (logic for https)
- createServer (logic for
http.createServer
)
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.
Two notes, anyway good work
781525c
to
7852e07
Compare
lib/Server.js
Outdated
} | ||
} | ||
|
||
this.createServer(); |
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.
Let's move this after this.setupHttps();
(no in method)
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.
fixed
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.
One note, and we can merge
7852e07
to
84eb4d6
Compare
Let's wait CI green and feel free to merge |
For Bugs and Features; did you add new tests?
no
Motivation / Use-Case
Reduce lines in constructor, delete eslint comments, fix typo, and etc..
Breaking Changes
no
Additional Info