Skip to content

Commit a2962c2

Browse files
committed
upgrade rewriter
1 parent e572355 commit a2962c2

5 files changed

Lines changed: 18 additions & 9 deletions

File tree

node_modules/rewriter/index.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/rewriter/package.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "datacouch",
33
"subdomain": "data",
44
"domains": [
5+
"datacouch.com",
56
"burritomap.com"
67
],
78
"bundleDependencies": [
@@ -31,7 +32,7 @@
3132
"engine": {
3233
"node": "0.6.x"
3334
},
34-
"version": "0.0.1-34",
35+
"version": "0.0.1-47",
3536
"scripts": {
3637
"start": "run.js"
3738
},

run.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,3 @@ provision(function(err) {
5252
console.log("running on " + router.port)
5353
})
5454
})
55-

service/burritomaps.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@ var stoopid = require('stoopid')
33
var request = require('request').defaults({json: true})
44
var Rewriter = require('rewriter')
55
var follow = require('follow')
6+
var _ = require('underscore')
67

78
module.exports = function (router, t) {
9+
10+
t.route("/api/burritomaps", function(req, resp) {
11+
resp.end(JSON.stringify(Object.keys(router.hosts)))
12+
})
13+
814
follow({db: t.couchurl+ 'datacouch', include_docs: true, filter: "datacouch/by_value", query_params: {k: "type", v: "app"}}, function(err, change) {
9-
if (err) return console.error(err)
15+
if (err) return console.error("follow error", t.couchurl+ 'datacouch', err)
16+
if (change.doc.deleted) return
1017
var ddoc = t.couchurl + change.doc.dataset + '/_design/' + change.doc.ddoc
1118
request(ddoc, function(err, resp, app) {
1219
function bootApp(app) {
@@ -16,12 +23,12 @@ module.exports = function (router, t) {
1623
router.host(change.doc._id + "." + t.appsurl, burritomap)
1724
t.sockets.emit(change.doc._id, {ok: true, url: change.doc._id + "." + t.appsurl})
1825
}
19-
if (err) return console.error(err)
26+
if (err) return console.error("request error", err)
2027
if (resp.statusCode === 404) {
2128
return copyCouchapp(change.doc.ddoc, t.couchurl + change.doc.dataset, function(err, resp) {
22-
if (err) return console.error(err)
29+
if (err) return console.error("copy error", err)
2330
request(ddoc, function(err, resp, app) {
24-
if (err) return console.error(err)
31+
if (err) return console.error("post copy error", err)
2532
return bootApp(app)
2633
})
2734
})

0 commit comments

Comments
 (0)