From fe398543a2ceef4d70f9b44375b10a8082e7fa7b Mon Sep 17 00:00:00 2001 From: dsc Date: Tue, 17 Apr 2012 17:31:11 -0700 Subject: [PATCH] Updates /graphslist to use files.readJSONFilesAsync --- lib/server/server.co | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) 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' -- 1.7.0.4