issue #478 - hot-swapping of plugins
parent
e480b1bace
commit
4353a9da25
@ -0,0 +1,25 @@
|
||||
var nconf = require('nconf'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
Plugins = require('../plugins'),
|
||||
|
||||
PluginRoutes = function(app) {
|
||||
// Static Assets
|
||||
app.get('/plugins/:id/*', function(req, res) {
|
||||
var relPath = req.url.replace('/plugins/' + req.params.id, '');
|
||||
if (Plugins.staticDirs[req.params.id]) {
|
||||
var fullPath = path.join(Plugins.staticDirs[req.params.id], relPath);
|
||||
fs.exists(fullPath, function(exists) {
|
||||
if (exists) {
|
||||
res.sendfile(fullPath);
|
||||
} else {
|
||||
res.redirect('/404');
|
||||
}
|
||||
})
|
||||
} else {
|
||||
res.redirect('/404');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = PluginRoutes;
|
Loading…
Reference in New Issue