This commit is contained in:
Martin Donnelly 2017-08-05 21:39:19 +01:00
parent d5457ddd9d
commit 9ce01dcf5f

2
app.js
View File

@ -79,7 +79,7 @@ app.get('/:encoded_id', function(req, res){
// check if url already exists in database
Url.findOneAndUpdate({_id: id}, {$inc:{visits:1}}, function (err, doc){
if (doc) {
logger.debug('doc', doc);
logger.debug(`Redirect: ${doc.long_url}`);
res.redirect(307, doc.long_url);
} else {
res.redirect(config.webhost);