mozilla / connect-cachify

Express connect middleware to provide easy frontend caching for Node.js
Mozilla Public License 2.0
132 stars 21 forks source link

Issue getting it to work for file in my public directory #13

Closed colin-jack closed 11 years ago

colin-jack commented 12 years ago

I'm possibly doing something wrong but I'm trying to use connect-cachify like this:

var assets = { '/public/javascripts/main.js' : [ '/public/javascripts/readingList.js', '/public/javascripts/jquery.js' ] };

app.use(cachify.setup(assets, { root: __dirname, production: true }));

...

!= cachify_js('/javascripts/main.js')

With those paths my page works OK, it brings in main.js. Unfortunately connect-cachify is not putting any content in it because it doesn't recognise the path:

''' Cachify bailing on hash... no such file /javascripts/main.js

{ [Error: ENOENT, no such file or directory '/home/colin/Development/RubymineProjects/linkedlist/web/app/javascripts/main.js'] errno: 34, code: 'ENOENT', path: '/home/colin/Development/RubymineProjects/linkedlist/web/app/javascripts/main.js', syscall: 'open' } '''

If I change it to be "cachify_js('/public/javascripts/main.js')" then cachify is happy but I get a 404 for the resource:

''' cache miss /public/javascripts/main.js cache hit /public/javascripts/main.js '''

ozten commented 12 years ago

Do you use the static middleware?

What does initializing that look like?

connect-cachify does not serve up any content. Did you expect it too? Probably a bug on my part, need better documentation...

ozten commented 11 years ago

I'm going to close this bug, please re-open if you still need help.