How do I call a function defined in app.js from my ejs template?

I have a function defined in app.js

var addUser = function(uname, pword, e_mail, name, callback){

var coll_model =  mongoose.model('collaborator', User);
var collaborator = new coll_model(
{
    username: uname,
    password : pword,
    email : e_mail,
    fullName : name
});

collaborator.save(function (err){
    if(err)
    {
        console.log('There was an error creating the user');
    }
});

callback(collaborator._id);

};

I want to be able to call this from my ejs template.

How does one go about this?

Thanks in advance

This is a server side operation. You should never invoke a function on the client that manipulates data directly at the database.

As you are using node and monogoDB, you could consider using express as your webframework. You can read about the communication between client -> server -> database here: http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/