From 0985d4663c6bacb68baebf8ae0b9d4fa169f1069 Mon Sep 17 00:00:00 2001 From: Bram van der Veen <96aa48@gmail.com> Date: Sat, 13 Jun 2015 16:01:07 +0200 Subject: [PATCH] Added get function, haven't made it work yet. --- package.json | 3 ++- schedule.js | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 244395e..090cc8e 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "dependencies": { "cheerio": "^0.19.0", "express": "^4.12.4", - "mongodb": "^1.4.38" + "mongodb": "^1.4.38", + "mongoskin": "^1.4.13" } } diff --git a/schedule.js b/schedule.js index b9d61e4..cbab26b 100644 --- a/schedule.js +++ b/schedule.js @@ -10,8 +10,9 @@ function lookup(req, res, next, search) { if (err) console.warn(err); if (database_entry.length == 1) { - var link = make_link(database_entry[0]); - res.redirect(link); + get(make_link(database_entry[0]), function (schedule) { + res.end(schedule); + }); } else if (database_entry.length == 0) { res.send('No matches were found in the database.'); @@ -46,4 +47,8 @@ function make_link(database_entry) { return link; } +function get(link, callback) { + console.log(link); +} + module.exports = lookup;