Skip to content
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

Upgrade Express to v4 #30

Merged
merged 1 commit into from
Feb 25, 2016
Merged

Upgrade Express to v4 #30

merged 1 commit into from
Feb 25, 2016

Conversation

kevinburkeshyp
Copy link

This was accomplished by installing Express 4, attempting to run the tests,
observing things that broke, and then fixing them. In some cases, I leaned on
the work done in balderdashy#3235 to figure out
how to do something. The most comprehensive change is to the router, which is
its own Router object, and no longer a function on an Express app.

Adds two new dependencies (which were removed from Express core): cookie-parser
and compression. In some cases we removed the dependency on Express instead of
upgrading - we no longer try to serve favicons, or deal with sessions.

@kevinburkeshyp
Copy link
Author

It's also worth noting that Sails core rejected the Express 4 upgrade in favor of calling all of the dependency modules (compression, cookie-parser, body-parser, serve-favicon, &c) directly. However, they haven't implemented that yet - they're still leaning on Express 3.

@benbuckman
Copy link

@kevinburkeshyp Can I make a process request in the future – if there are members of the team who have expressed interest in changing or knowing about particular parts of the system, could you FYI/ping them on PRs that make those changes? For example, I'm very interested in this change (and will review this later today), but would have easily missed the update in Slack if I hadn't happened to see the mention in the #platform channel.

Thanks!

@kevinburkeshyp
Copy link
Author

Sure - I also tried to ping you in #growth-team

@benbuckman
Copy link

Oh, my bad – I see that you did ping me there. Thank you!

// This is so that all the built-in core Express/Connect middleware
// gets called before matching any explicit routes or implicit shadow routes.
router: app.router,

// Add powered-by Sails header
poweredBy: function xPoweredBy(req, res, next) {

Choose a reason for hiding this comment

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

Can we turn this off? It's a potential security hole to announce the server software. Express4 (and maybe 3 too) allow it to be disabled with app.set('x-powered-by', false) (see docs).

Copy link
Author

Choose a reason for hiding this comment

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

yep totally fine by me, I'll do in separate PR

Copy link
Author

Choose a reason for hiding this comment

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

#31

@benbuckman
Copy link

@kevinburkeshyp Thank you for doing this.
I can't tell from this PR what changes are needed in the API to accommodate this – is there a PR on that side too? Let me know if I can help with this.
This opens up tons of opportunities.

@kevinburkeshyp
Copy link
Author

I can't tell from this PR what changes are needed in the API to accommodate this – is there a PR on that side too? Let me know if I can help with this.

Not yet, I guess I can run the API tests against this branch and see what passes/fails. I was going to try and get this through first.

@@ -31,10 +31,12 @@
"captains-log": "0.11.11",
"colors": "0.6.2",
"commander": "2.1.0",
"compression": "^1.6.1",

Choose a reason for hiding this comment

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

wildcard.

Copy link
Author

Choose a reason for hiding this comment

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

Ah, whoops! Fixed!

@caseycrites
Copy link

One comment, otherwise this looks like 🍧 to me.

This was accomplished by installing Express 4, attempting to run the tests,
observing things that broke, and then fixing them. In some cases, I leaned on
the work done in balderdashy#3235 to figure out
how to do something. The most comprehensive change is to the router, which is
its own Router object, and no longer a function on an Express `app`.

Adds two new dependencies (which were removed from Express core): cookie-parser
and compression. In some cases we removed the dependency on Express instead of
upgrading - we no longer try to serve favicons, or deal with sessions.
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