UNPKG

@mdf.js/service-registry

Version:

MMS - API - Service Registry

37 lines 1.14 kB
"use strict"; /** * Copyright 2024 Mytra Control S.L. All rights reserved. * * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file * or at https://opensource.org/licenses/MIT. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Controller = void 0; const utils_1 = require("@mdf.js/utils"); /** Controller class */ class Controller { /** * Create an instance of Controller class * @param service - service instance */ constructor(service) { this.service = service; } /** * Get all the error in the registry * @param request - HTTP request express object * @param response - HTTP response express object * @param next - Next express middleware function */ errors(request, response, next) { const errors = this.service.errors(); if (errors.length !== 0) { response.status(200).json((0, utils_1.deCycle)(errors)); } else { response.status(204).send(); } } } exports.Controller = Controller; //# sourceMappingURL=registry.controller.js.map