mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-08 05:03:39 +08:00
using asynchandlerwrapper, removed try catch
This commit is contained in:
parent
596673af1d
commit
779faf42da
2 changed files with 8 additions and 9 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue