using asynchandlerwrapper, removed try catch

This commit is contained in:
Miodec 2022-02-01 18:26:59 +01:00
parent 596673af1d
commit 779faf42da
2 changed files with 8 additions and 9 deletions

View file

@ -1,13 +1,9 @@
const PsaDAO = require("../../dao/psa");
class PsaController {
static async get(req, res, next) {
try {
let data = await PsaDAO.get();
return res.status(200).json(data);
} catch (e) {
return next(e);
}
static async get(req, res) {
let data = await PsaDAO.get();
return res.status(200).json(data);
}
}

View file

@ -1,11 +1,14 @@
const { authenticateRequest } = require("../../middlewares/auth");
const PsaController = require("../controllers/psa");
const RateLimit = require("../../middlewares/rate-limit");
const {
asyncHandlerWrapper,
requestValidation,
} = require("../../middlewares/api-utils");
const { Router } = require("express");
const router = Router();
router.get("/", RateLimit.psaGet, PsaController.get);
router.get("/", RateLimit.psaGet, asyncHandlerWrapper(PsaController.get));
module.exports = router;