Permalink
Browse files

updated docs.

  • Loading branch information...
1 parent e63a0af commit 50bcf9d2125fda7ca4f67ce681a8138f824c5a5c @podviaznikov committed Aug 17, 2011
Showing with 24 additions and 4 deletions.
  1. +22 −2 README.md
  2. +2 −2 lib/app-cache.js
View
@@ -4,14 +4,34 @@
## Usage
-Install via NPM
+Install via NPM:
$ npm install connect-app-cache
-Include into connect application
+Use it in your code:
+
+ $ var appCache = require('connect-app-cache');
+
+Include into connect application:
$ connect.createServer(connectAppCache.appCache());
+
+Include into express application:
+
+ $ ...
+ var app = express.createServer();
+ app.configure(function(){
+ ...
+ app.use(appCache("app.mf",__dirname+"/app.mf"));
+ });
+
+appCache has following parameters:
+ 1. fileName - name of the manifest file which you will use in html: <html manifest="app.mf">... Default is app.mf
+ 2. filePath - path to the manifest file on the filesystem. Default is __dirname+"/public/app.mf"
+ 3. options - som extra options. You can specify maxAge for caching this file. Default is 1 hour.
+
+
## License
(The MIT License)
View
@@ -12,8 +12,8 @@ module.exports=function appCache(fileName, filePath, options){
var options = options || {},
fileName = fileName || 'app.mf',
filePath = filePath || __dirname + '/../public/'+fileName,
- // max age. Default to one day
- maxAge = options.maxAge || 86400000;
+ // max age. Default to one hour
+ maxAge = options.maxAge || 1000*60*60;
console.log("enetered app_cached")
return function appCache(req,res,next){
console.log('req urk',req.url);

0 comments on commit 50bcf9d

Please sign in to comment.