You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 lines
646 B

export function staticFiles(req, res) {
const fileName = req.params[0];
const path = `blocks/@${req.params.project}/${req.params.blockName}/src/${fileName}`;
return deliverStaticFile(path, res);
}
export function previewFiles(req, res) {
const fileName = req.params[0];
const path = `blocks/@${req.params.project}/${req.params.blockName}/design/${fileName}`;
return deliverStaticFile(path, res);
}
function deliverStaticFile(path, res) {
// If file doesn't exist, return 404.
res.sendFile(path, {root: './'}, function (err) {
if (err) {
res.send('File not found.');
res.status(err.status).end();
}
});
}