From cc70ec9cb09172167e7ed334b2ab1def391c6d59 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 29 Jun 2012 19:18:32 +0200 Subject: o Adding links. --- routes/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'routes') diff --git a/routes/index.js b/routes/index.js index 0bd432d..6d57023 100644 --- a/routes/index.js +++ b/routes/index.js @@ -25,7 +25,17 @@ exports.render = function(req, res){ else { var parsedBody = JSON.parse(body); var doc = collection_json.fromObject(parsedBody); + var isUrl = function(u) { + try { + var x = url.parse(u); + return _.isString(x.protocol) && _.isString(x.host) && _.isString(path); + } + catch(e) { + return false; + } + }; res.render('data', { + isUrl: isUrl, url: req.query.url, doc: doc, headers: headers, -- cgit v1.2.3