Getting user info from a button on the client side with node Getting user info from a button on the client side with node mongoose mongoose

Getting user info from a button on the client side with node


You can use a GET parameter on your route like this:

on your template:

<% users.forEach(function(Tuser) { %>   <% if(Tuser.id != user.id) { %>       <li class="list-group-item">           <a href="<%= '/posts/othersblog/' + Tuser.username %>"><h5><%= Tuser.username %></h5></a>       </li>   <% } %><% }); %>

Then on your route:

router.get('/othersblog/:username',(req,res) => {    res.render('othersblog',{        headline: "Website | User Blog",        title: "Blog",        Tuser: req.params.username,    });});