You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i just need to report a strange behaviour that I'm having.
varCluster=require('cluster2'),express=require('express'),engine=require('ejs-locals'),ejs=require('ejs'),app=express(),port=8080;varserving=true;GLOBAL.global_test="global testing"app.configure(function(){app.engine('ejs',engine);app.set('views',__dirname+'/views');app.set('view engine','ejs');app.set('view options',{layout: false});});app.get('/',function(req,res){res.locals({test:"testing response"})//this is wrong, res.locals have to propagate down the chainres.render("./test.ejs",res.locals());if(!serving){req.connection.end();}});varc=newCluster({port: port,cluster: true,timeout: 500,ecv: {path: '/ecv',control: true,monitor: '/',validator: function(){returntrue;}}});c.on('died',function(pid){console.log('Worker '+pid+' died');});c.on('forked',function(pid){console.log('Worker '+pid+' forked');});c.listen(function(cb){cb(app);});
res.locals() is not working as should be. Using cluster2 I have to pass the object as argument on rendering. But in expressjs this will automatically be passed into res object and bubble until reach the engine system.
<html><head><title></title></head><body>
Testing:<br><%= test %><br><%= global_test %></body></html>
My first guess that we have a problem with globals. But globals is working fine. Any guess?
Thank you, cluster2 is a great code! 👍
Cheers
The text was updated successfully, but these errors were encountered:
hi!
i just need to report a strange behaviour that I'm having.
res.locals() is not working as should be. Using cluster2 I have to pass the object as argument on rendering. But in expressjs this will automatically be passed into res object and bubble until reach the engine system.
My first guess that we have a problem with globals. But globals is working fine. Any guess?
Thank you, cluster2 is a great code! 👍
Cheers
The text was updated successfully, but these errors were encountered: