Q:

How to get user information from a given ID and display it using Node.js and EJS

i have a home page that uses the EJS template, 
i want to display a user's name (not the user that has logged in now) using the user's id from the URL
the page is called like this:
/home?id=235325325235

here is a part of home.ejs:
<!-- i want to get the username or other info of another user -->
<p> Hello <%= get.otheruser.name(id) %> </p>

here is a part of my routes.js
// load up the user model
var User       = require('../app/models/user');

app.get('/home', function(req, res) {
    res.render('home.ejs', {
        id              : req.query.id,
        otheruser       : User.findById( req.query.id ), //error this doesn't get the info i need
        currentuser     : req.user  //ignore this, this is the information of the current logged in user
    });
});

But, what happens if the logged in user want to view the home page of another user?
He would call the home page with the id of the other user, 
/home?id=43565476535

I need a function that gets all the information using the ID from the URL
how is this done with node.js?

A:

To answer my question, i found a way.
app.get('/home', function(req, res) {
    //get user information based on the id url parameter
    User.findById(req.query.id, function(err, doc) {
            res.render('home.ejs', {
                id     : doc._id
            });     
    });
});

It needed the findById to get the user id using the id from the URL.

