1
0
mirror of https://github.com/dap-ps/discover.git synced 2025-01-31 11:35:18 +00:00
discover/back-end/routes/dapps-routes.js
2019-06-03 21:01:42 +03:00

33 lines
1.2 KiB
JavaScript

const DAppsMetadataController = require('./../controllers/dapps-metadata-controller');
const rateLimit = require('./../middlewares/route-specifics/rate-limit');
const cutSensitives = require('./../middlewares/route-specifics/cut-sensitives');
const adminAuthorization = require('./../middlewares/route-specifics/admin-authorization');
class DappRoute {
static build(expressApp) {
let dappRoute = expressApp.Router();
dappRoute.post('/', rateLimit, DAppsMetadataController.uploadDAppMetadata);
dappRoute.post('/update/:dappId', DAppsMetadataController.setMetadataStatus);
dappRoute.post('/reject/:hash', adminAuthorization, DAppsMetadataController.rejectDApp);
dappRoute.post('/approve/email/:hash', DAppsMetadataController.sendApprovalEmail);
dappRoute.post('/approve/:hash', adminAuthorization, DAppsMetadataController.approveDApp);
dappRoute.get('/all', cutSensitives, DAppsMetadataController.getAllDappsMetadata);
dappRoute.get('/:hash', cutSensitives, DAppsMetadataController.getDAppMetadata);
dappRoute.get('/image/:hash', cutSensitives, DAppsMetadataController.getDAppImage);
return dappRoute;
}
}
module.exports = DappRoute;