Monday 16 October 2017

Pass variable to template with odd twist

I am trying to pass the result of a find() search to my tempate but since I am using a middleware from a template I decided to use (never again), I seem to set the redirect before my res.render() and that causes double headers, okay no problem. Remove that right? Well no, it says path must be a string.How else can I send the data though, I need to be able to inside an if statement at the end of my route pass {ap:allAP} as that is the result of my find()I am using Node.js v8.x Express latest Swig latest [middleware-responder] Check this out to understand res.Redirect and setRender// show model app.get('/dashboard/it/model', //setRender('dashboard/it/model'), setRedirect({auth: '/login'}), isAuthenticated, dashboard.getDefault, (req, res) => { AP.find({}, function(err, allAP){ if(err){ console.log(err); } else { setRender('dashboard/it/model',{ap:allAP}); } }); }); Another way I tried, I am really grabbing at straws now..// show model app.get('/dashboard/it/model', (req, res) => {AP.find({}, function(err, allAP){ if(err){ console.log(err); } else { res.render('dashboard/it/model',{ap:allAP}); } });}, setRender('dashboard/it/model'), setRedirect({auth: '/login'}), isAuthenticated, dashboard.getDefault, (req, res) => { }); (http://ift.tt/1sPVq71)

Submitted October 16, 2017 at 10:34PM by jsdfkljdsafdsu980p

No comments:

Post a Comment