Added get function, haven't made it work yet.
This commit is contained in:
parent
3fc23d6ca8
commit
0985d4663c
|
@ -11,6 +11,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cheerio": "^0.19.0",
|
"cheerio": "^0.19.0",
|
||||||
"express": "^4.12.4",
|
"express": "^4.12.4",
|
||||||
"mongodb": "^1.4.38"
|
"mongodb": "^1.4.38",
|
||||||
|
"mongoskin": "^1.4.13"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,9 @@ function lookup(req, res, next, search) {
|
||||||
if (err) console.warn(err);
|
if (err) console.warn(err);
|
||||||
|
|
||||||
if (database_entry.length == 1) {
|
if (database_entry.length == 1) {
|
||||||
var link = make_link(database_entry[0]);
|
get(make_link(database_entry[0]), function (schedule) {
|
||||||
res.redirect(link);
|
res.end(schedule);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if (database_entry.length == 0) {
|
else if (database_entry.length == 0) {
|
||||||
res.send('No matches were found in the database.');
|
res.send('No matches were found in the database.');
|
||||||
|
@ -46,4 +47,8 @@ function make_link(database_entry) {
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get(link, callback) {
|
||||||
|
console.log(link);
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = lookup;
|
module.exports = lookup;
|
||||||
|
|
Loading…
Reference in a new issue