-
-
Save palakbhansali/f7d3176bbef31f1ec7ee to your computer and use it in GitHub Desktop.
express-cdn not working in production mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sslEnabled = false; | |
// Set the CDN options | |
var options = { | |
publicDir : path.join(__dirname, '/../public'), | |
viewsDir : path.join(__dirname, '/../views'), | |
domain : <cdn.mysite.com>, | |
bucket : <bucket-mysitename>, | |
key : <aws user access key id>, | |
secret : <aws user key secret>, | |
endpoint : <bucket-name>.s3.amazonaws.com', // optional | |
hostname : <mysite.com>, | |
port : (sslEnabled) ? 443 : app.get('port'), | |
ssl : sslEnabled, | |
production: true, | |
logger : winston.info | |
}; | |
// Initialize the CDN magic | |
var CDN = require('express-cdn')(app, options); | |
// Add the view helper | |
app.locals.CDN = CDN(); | |
require('../server'); | |
http.createServer(app) | |
.listen(app.get('port'), function () { | |
console.log('Express production server listening on port '.blue + app.get('port')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment