node.js - how do I use res.render with mongoose find function? -


i have route gets of clients in mongodb , returns them. when try use res.render() mongoose find() callback, error saying referenceerror: res not defined

here's code works , i've confirmed returning clients:

app.get( '/clients', function( request, response ) {     return clientmodel.find( function( err, clients ) {         if( !err ) {             return response.send( clients );         } else {             return console.log( err );         }     }); }); 

here's code i'm trying use render ejs view, while passing list of clients:

app.get( '/clients', function( request, response ) {     return clientmodel.find( function( err, clients ) {         if( !err ) {             res.render('clients/clients.ejs', {               clients: clients             });         } else {             return console.log( err );         }     }); }); 

how can work?

use response.render instead of res.render.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -