Skip to content

Commit

Permalink
feat: add audit quick endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
@jotadeveloper authored and sergiohgz committed Jul 31, 2019
1 parent 7c3a6d3 commit 5ab2ece
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions plugins/audit/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,23 @@ export default class ProxyAudit {

return fetchAu;
};
/* eslint new-cap:off */
const router = express.Router();
/* eslint new-cap:off */
router.use(compression());
router.use(bodyParser.json({ strict: false, limit: '50mb' }));
router.post('/audits', (req: $RequestExtend, res: $ResponseExtend) => {

const handleAudit = (req: $RequestExtend, res: $ResponseExtend) => {
if (this.enabled) {
fetchAudit(req, res);
} else {
res.status(500).end();
}
});
};

/* eslint new-cap:off */
const router = express.Router();
/* eslint new-cap:off */
router.use(compression());
router.use(bodyParser.json({ strict: false, limit: '50mb' }));
router.post('/audits', handleAudit);

router.post('/audits/quick', handleAudit);

app.use('/-/npm/v1/security', router);
}
Expand Down

0 comments on commit 5ab2ece

Please sign in to comment.