git ssb

0+

Dominic / weather



Commit fd34a5972d6780e766d62417677c8e9f5f837c3e

expose graph of summary data

Dominic Tarr committed on 9/24/2018, 8:11:50 AM
Parent: f0d561545097816cc53c00eb465e57902203318a

Files changed

db.jschanged
server.jschanged
db.jsView
@@ -95,20 +95,22 @@
9595 })
9696 return state
9797 }
9898
99-pull(
100- pl.read(sample),
101- pull.asyncMap(function (index, cb) {
102- rawdb.get(index.value, function (err, value) {
103- cb(null, summary(value))
104- })
105- }),
106- pull.filter(),
107- pull.reduce(reduce, function (err, data) {
108- console.log(JSON.stringify(data, null, 2))
109- })
110-)
99 +db.summary = function (cb) {
100 + pull(
101 + pl.read(sample),
102 + pull.asyncMap(function (index, cb) {
103 + rawdb.get(index.value, function (err, value) {
104 + cb(null, summary(value))
105 + })
106 + }),
107 + pull.filter(),
108 + pull.reduce(reduce, cb)
109 + )
110 +}
111111
112112 module.exports = db
113113
114114
115 +
116 +
server.jsView
@@ -79,8 +79,13 @@
7979 })
8080 }
8181
8282 http.createServer(Stack(
83 + route(/^\/summary.json$/, function (req, res) {
84 + db.summary(function (err, data) {
85 + res.end(JSON.stringify(data, null, 2))
86 + })
87 + }),
8388 route(/^\/([0-9a-f]{64})(\.\w+)?$/, function (req, res, next) {
8489 get(req.params[0], req.params[1], res, next)
8590 }),
8691 route(/^\/([a-z\-_]+)(\.\w+)?$/, function (req, res, next) {
@@ -138,4 +143,6 @@
138143 })
139144 })()
140145
141146
147 +
148 +

Built with git-ssb-web