Finally, I made it simpler...
I made a link from /toto/myfiles to public/uploads/myfiles. Then, I wrote this app.get code in my plugin :
app.get('/uploads/myfiles/:file(*?)', function (req, res) {
// Things TODO with req.params.file for permissions (after work on it)...
var longfilename = path.resolve('public' + req.url);
if (fs.existsSync(longfilename)) {
res.status(200);
res.sendFile(longfilename);
} else {
console.log('Fichier non trouvé');
res.status(404);
res.render('404', {path: req.path});
}
});
Now, there is no problem with the ajaxify thing... Ouf !
I'm going to open another topic for another question about the 404 error rendering... 😉