I would like to display a new page without starting a new socket instance. Here is what I'm doing.
app.configure(function(){
app.set('port', 8080);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(express.static(path.join(__dirname, 'public')));
});
io.sockets.on('connection', function(socket){
app.render('board' , { option : 'somestuff'} , // line with type error
function(err, html) {
console.log(html); // outputs html with option values inserted
}
);
I cannot get the page to render and the console is giving me this error
[ERROR] TypeError
TypeError: undefined is not a function
However this does not seem right as the documentation tells me this is the correct syntax and when I attach it to app.get('/', function(req, res) { /*same code but res.render instead */ }); it works just fine. Also when I log the html to the console I get the correct page with the options placed into the template.
What am I doing wrong?