Last Updated: February 25, 2016
·
773
· nevtep

Node.js express-cdn support on Nodejitsu

Recently I moved from AWS to Nodejitsu and found dome functionality of express-cdn (https://github.com/niftylettuce/express-cdn) was braking my app. Express CDN uses some core libs to optimize images that need to be installed on drones. Since Nodejitsu had no support for those I had to make a workaround and I decided to write this Pro Tip if you ever need to have express-cdn functionality on Nodejitsu.

What I did was fork the repo ( https://github.com/RealFilling/express-cdn ) and removed the optimization for jpeg and png, and left them as images (If Nodejitsu starts supporting those you can always put that back) and then changed my package.json dependency like this:

"dependecies" : [
    (...)
    "express-cdn" : "https://github.com/RealFilling/express-cdn/tarball/master",
   (...)
]

You still get the gzip compression, versioning of your assets, automatic upload to S3 and the cool functionality that express-cdn provides for you. Now on Nodejitsu!

Hope you like it!