Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private setUploadsFolder() {
const uploads = path.resolve(process.cwd(), 'public', 'uploads');
Server.setFileDest(uploads);
}
{ from: 'keys', to: 'key' },
{ from: 'manifests', to: 'manifest' },
{ from: 'revision-history', to: 'revision-history' },
{ from: 'dependents', to: 'dependent' },
{ from: 'resource/policy', to: 'resource/policy' },
];
prefixes.forEach((prefix) => {
app.all(`/${prefix.from}/*`, (req, res, next) => {
req.query['keyPath'] = req.params[0];
req.url = `/${prefix.to}`;
next();
});
});
Server.setFileDest('uploads/');
Server.buildServices(
app,
AppsController,
TagsController,
SearchController,
BulkKeysUpload,
SchemaController,
KeysController,
PolicyController,
ResourcePolicyController,
SubjectExtractionRulesController,
);
return app;
}