Nodejs view guess multiple extensions

I have Jade set as my primary view engine but also have some pages in ejs

How can I make it such that when I call res.render('view') it guesses both view.jade as well as view.ejs (and uses the appropriate engine)?

Right now I am getting an error when I specify an EJS page

failed to located view "viewname", tried:
/views/viewname.jade
/views/viewname/index.jade
/views/../viewname/index.jade

What part of node defines what views are tried? Connect/Express? The view engines themselves? Is there anything I can do with app.register or similar?

There's no way that I know of to make express try alternative extensions for views. But so what? If you know that "view" really means "view.ejs", just write res.render('view.ejs') and express will be very happy to comply with your wishes. As a developer, you can be expected to know what template engine your views are written for. If you're part of a team that's so fragmented that front-end developers and back-end developers don't talk to each other enough that either knows what the other is using to write templates, you're dealing with an organizational problem, not a programming problem.