From 49148644ea00578ba27519742f7fbfcba27f3413 Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Tue, 16 Sep 2008 11:15:00 -0400 Subject: [PATCH] templates for app generate --- lib/couchrest/helper/templates/example-map.js | 8 ++++++ .../helper/templates/example-reduce.js | 10 +++++++ lib/couchrest/helper/templates/index.html | 26 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 lib/couchrest/helper/templates/example-map.js create mode 100644 lib/couchrest/helper/templates/example-reduce.js create mode 100644 lib/couchrest/helper/templates/index.html diff --git a/lib/couchrest/helper/templates/example-map.js b/lib/couchrest/helper/templates/example-map.js new file mode 100644 index 0000000..878684d --- /dev/null +++ b/lib/couchrest/helper/templates/example-map.js @@ -0,0 +1,8 @@ +// an example map function, emits the doc id +// and the list of keys it contains + +function(doc) { + var k, keys = [] + for (k in doc) keys.push(k); + emit(doc._id, keys); +}; diff --git a/lib/couchrest/helper/templates/example-reduce.js b/lib/couchrest/helper/templates/example-reduce.js new file mode 100644 index 0000000..23f61c5 --- /dev/null +++ b/lib/couchrest/helper/templates/example-reduce.js @@ -0,0 +1,10 @@ +// example reduce function to count the +// number of rows in a given key range. + +function(keys, value, rereduce) { + if (rereduce) { + return sum(values); + } else { + return values.length; + } +}; \ No newline at end of file diff --git a/lib/couchrest/helper/templates/index.html b/lib/couchrest/helper/templates/index.html new file mode 100644 index 0000000..5e48e98 --- /dev/null +++ b/lib/couchrest/helper/templates/index.html @@ -0,0 +1,26 @@ + + + + Generated CouchApp + + + +

Generated CouchApp

+ + + + + + + \ No newline at end of file