Code Monkey home page Code Monkey logo

Comments (7)

niftylettuce avatar niftylettuce commented on August 29, 2024

any luck?

from express-cdn.

mderazon avatar mderazon commented on August 29, 2024

I tried to add CDN() to my req object and do something like

app.use(function(req, res, next) {
  res.send(req.CDN('/path/to/asset'));
});

It actually generates a CDN address for the asset but it's not being processed and uploaded to the CDN.
I guess it's because all of the assets are being scanned in the views dir and only on start time.

I am assuming that we have to scan on start time because of the propagation time it takes the files to go from S3 to CDN.

Can't think of any way to work around this...

from express-cdn.

niftylettuce avatar niftylettuce commented on August 29, 2024

maybe just use in your views and since it will
get uploaded you can reference it with res.send?

On Wed, Dec 4, 2013 at 3:05 AM, Michael Derazon [email protected]:

I tried to add CDN() to my req object and do something like

app.use(function(req, res, next) {
res.send(req.CDN('/path/to/asset'));
});

It actually generates a CDN address for the asset but it's not being
processed and uploaded to the CDN.
I guess it's because all of the assets are being scanned in the views dir
and only on start time.

I am assuming that we have to scan on start time because of the
propagation time it takes the files to go from S3 to CDN.

Can't think of any way to work around this...


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-29786269
.

from express-cdn.

niftylettuce avatar niftylettuce commented on August 29, 2024

@mderazon how did that work?

from express-cdn.

psaia avatar psaia commented on August 29, 2024

@niftylettuce How would you recommend to handle dynamically generated assets? For example, the adding and displaying of user profile images.

Use case:

someObj.on "uploadComplete", (err, tmpFile) ->
  image = CDN(tmpFile, raw: true)
  saveImage(image)

I would be happy to contribute if you think this type of functionality wouldn't be out of scope for this project. If it is out of scope, do you think handling these on-the-fly uploads would be best handled using the aws-sdk module independently?

from express-cdn.

niftylettuce avatar niftylettuce commented on August 29, 2024

@petesaia why not just use Gravatar for user profile images? I don't know the use case or why you need to handle dynamically generated assets, why aren't they generated ahead of time? Not sure what your service/use case is... there is probably a better way to solve it for you ahead of time (maybe Grunt or caching somehow?).

from express-cdn.

psaia avatar psaia commented on August 29, 2024

@niftylettuce Thanks for the quick reply and suggestion. The use case of an avatar was just an example. For the actual application, users are able to upload multiple images which need to get pushed up to the CDN post-startup. We actually decided to go with pkgcloud for only that component and stick with express-cdn for assets which are perfectly okay to be pre-compiled and pre-cached.

from express-cdn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.