From cb156c626a1f778d1aac9067e65a0043ed00d271 Mon Sep 17 00:00:00 2001 From: Beppe Date: Thu, 28 Feb 2019 21:16:30 +0100 Subject: [PATCH] pls --- index.js | 2 +- views/index.handlebars | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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}} +
+
method='post'> + +
    + {{#each this.pagenums}} +
  • {{this}}
  • + {{/each}} +
+
+