I recently switched to Node/Express, and I have a PHP file that was made before this decision. Is it possible to use two different view engines? I tried including php-express
, but I get a failed to lookup view error.
I figured it was because I can't have these lines consecutively, because express would just overwrite one...
app.set('view engine', 'php');
app.set('view engine', 'pug');
I tried setting the view engine just before the GET request instead like this:
app.get('/avail', function(req, res, next){
app.set('view engine', 'php');
res.render('availability.php');
})
However, this just gave me this error:
Error: Command failed: php H:\Node\node_modules\php-express\lib\PHPExpress/../../page_runner.php H:\Node\views H:\Node\views\availability.php 'php' is not recognized as an internal or external command, operable program or batch file.
My only conclusion is that I just have to rewrite the file with pug, but I wanted to avoid it if there were a way to just render this php file.