compound icon indicating copy to clipboard operation
compound copied to clipboard

Update Expressjs dependency to 4.x

Open xgenvn opened this issue 10 years ago • 15 comments

I have a question about compoundjs that will maintainers consider upgrading to expressjs 4.x on roadmap? I'm looking for fresh framework which is using expressjs 4.x but seems most of them stay using 3.x.

Thank you.

xgenvn avatar Jun 07 '14 13:06 xgenvn

same here.

qfox avatar Jun 09 '14 18:06 qfox

+1

xpepermint avatar Jul 05 '14 07:07 xpepermint

/cc @xgenvn @zxqfox @xpepermint Maybe we can help to upgrading to expressjs 4.x? Lets offer this to maintainer :)

alexbaumgertner avatar Jul 09 '14 18:07 alexbaumgertner

Maintainer don't mind unless you didn't break everything ;) But as far as I know express 4.0 changes it shouldn't be big problem.

On 9 July 2014 19:44, Alex Baumgertner [email protected] wrote:

/cc @xgenvn https://github.com/xgenvn @zxqfox https://github.com/zxqfox @xpepermint https://github.com/xpepermint Maybe we can help to upgrading to expressjs 4.x? Lets offer this to maintainer :)

— Reply to this email directly or view it on GitHub https://github.com/1602/compound/issues/628#issuecomment-48516973.

anatoliychakkaev avatar Jul 09 '14 18:07 anatoliychakkaev

@alexbaumgertner sure, let's do it.

qfox avatar Jul 10 '14 02:07 qfox

@alexbaumgertner Alex, I have 2 days to work on it. Can you share your work if you started already?

qfox avatar Jul 12 '14 06:07 qfox

I have weekends to work for it. But I am not very familiar with expressjs and compoundjs, am learning these at the time.

alexbaumgertner avatar Jul 13 '14 20:07 alexbaumgertner

+1

sachinik19 avatar Sep 10 '14 07:09 sachinik19

I have migrated a few different internal services to 4.x. I found this article very helpful: http://strongloop.com/strongblog/express-3-to-4-migration-guide/

keeneym avatar Sep 10 '14 17:09 keeneym

For those interested I have an updated version that so far seems to be working fine with express 4. It's at https://github.com/jfremy/compound/tree/express4. The only thing I had to modify was the logic in injectMiddleware which does not work with express 4 + the template files to load the mw that are not included with express 4.

NOTE: if you use ejs, know that ejs 2.0 seems to be breaking with compound. So in your package.json, set it to use ejs 1.0.

To test on an existing application:

  • update your package.json to use git+https://github.com/jfremy/compound.git#express4
  • update your package.json to use express 4.x
  • add to your app's package.json the MW that were removed from express: body-parser, cookie-parser, errorhandler, express-session, method-override
  • update your app's environment.js and config/environment/*.js to be express 4 compatible (meaning, load the MW that are not included in express and use them and replace the use of app.configure by an if). You can check the template ones in my compound repo for guidelines.

To test on a new app:

  • install my version of compound somewhere
  • use it to generate a new app
  • edit the package.json of the new app to point my compound repo (git+https://github.com/jfremy/compound.git#express4)
  • npm install ...

If there is not negative feedback, I'll submit a pull request

jfremy avatar Jan 11 '15 03:01 jfremy

Yeah ejs 2.0 is bringing down the whole shabang. I just found that out after hours and hours of poking around. Any idea why?

alexiskattan avatar Jan 15 '15 05:01 alexiskattan

also the npm "engines": { "node": "0.10.*", "npm": "1.4.x" },

npm can't be upgraded to 2.1.X

Any ideas?

alexiskattan avatar Jan 15 '15 05:01 alexiskattan

one other thing, there is an issue with cached js/css could you add this fix to your repository? https://github.com/sagish/compound/commit/6986033a53838721ec84f0b3ff0205fd486d37c8

alexiskattan avatar Jan 15 '15 09:01 alexiskattan

My express 4 branch has a fix for compound or you can check my pull request to compound that contains only the fix. https://github.com/1602/compound/pull/646

The issue is that render was calling next in the wrong place. In the case of synchronous operations in the template engine, it worked ok, but now that ejs has introduced some level of asynchrony, it failed.

jfremy avatar Jan 15 '15 09:01 jfremy

sorry for the delay but cached js/css bugfix is in

jfremy avatar Feb 26 '15 10:02 jfremy