samedi 28 février 2015

How to render a view file included a dot (.) character?

I'm trying to render a view file named cores.index.view, However, I always got Error: Cannot find module 'view'. It seems like Express interprets the dot of the file name as a file extension instead of a normal file name.



// Partials template, jade format, for angular.js
exports.views = function (req, res) {
//Get data from regex (*)
var path = req.params['0']; // path equals to cores.index.view
res.render('../../packages/' + path);
};


I tried to search about this issue, however, didn't find anything related to this topic. Any help would be appreciated.


Aucun commentaire:

Enregistrer un commentaire