Monday 21 November 2016

[ask] can i use res.redirect with parameter url?

hi reddit.I want to have my create(CRUD) form redirect to the new page that i just create.in route list you can useapp.use('/page/id=:id',page.detail); but i can't use it in redirect. after inserting the new pageconnection.query("INSERT INTO page set ? ", data, function (err) { if (err) console.log("Error inserting : %s ", err); connection.query("SELECT MAX(pageId) as id FROM page", function(err,pages){ console.log("Error inserting : %s ", err); console.log(pages.id); res.redirect('/page/id=:pages.id'); //this part is the problem. }); }); is there a way to solve this?

Submitted November 22, 2016 at 07:07AM by blackkey30

No comments:

Post a Comment