diff --git a/index.js b/index.js index 0154e89..9f27e9f 100644 --- a/index.js +++ b/index.js @@ -54,7 +54,7 @@ app.post('/search', (req, res) => { temp = client.db().collection("questions").find(query).toArray(function(err, data) { arr = splice(data) page = 0 + parseInt(req.body.page, 10) - res.render('index', {data: arr[page],page:page,pagenums:Array.from(new Array(arr.length), (x,i) => i),maxpages:arr.length}) + res.render('index', {search:req.body.title, data: arr[page],page:page,pagenums:Array.from(new Array(arr.length), (x,i) => i),maxpages:arr.length}) client.close() }) }); diff --git a/views/index.handlebars b/views/index.handlebars index 636c880..7ddb116 100644 --- a/views/index.handlebars +++ b/views/index.handlebars @@ -19,4 +19,14 @@ {{/each}} +