From: dsc Date: Wed, 18 Apr 2012 00:31:11 +0000 (-0700) Subject: Updates /graphslist to use files.readJSONFilesAsync X-Git-Url: http://git.less.ly:3516/?a=commitdiff_plain;h=fe398543a2ceef4d70f9b44375b10a8082e7fa7b;p=limn-bak.git Updates /graphslist to use files.readJSONFilesAsync --- diff --git a/lib/server/server.co b/lib/server/server.co index e0d98da..7a53335 100755 --- a/lib/server/server.co +++ b/lib/server/server.co @@ -183,15 +183,10 @@ app.get '/datasources/all', (req, res, next) -> # can be used to instantiate a GraphList of Graph Models. app.get '/graphslist' (req, res) -> Seq() - # find list of data/graph/*.json files - .seq -> @ok glob.sync "#DATA/graphs/*.json" - # read them each in - .seq (paths) -> readFilesAsync paths, this - # parse each file into a JSON object and send it as the response - .seq (data) -> - graphs = ( for f, txt in data then JSON.parse txt ) - res.send graphs - + # find list of data/graph/*.json files, send back the objects + .seq -> readJSONFilesAsync "#DATA/graphs/*.json", this + # remove filepath info + .seq (graphs) -> res.send _.values graphs app.get '/', (req, res) -> res.render 'dashboard'