UNPKG

filesrocket

Version:

Filesrocket is a Node.js package that takes care of the file management of any cloud storage service (Local, Cloudinary, Amazon S3)

46 lines 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Filesrocket = void 0; const file_controller_1 = require("./controllers/file.controller"); class Filesrocket { constructor() { this.entities = new Map(); } /** * Register a new service * @param name Service name * @param service ServiceMethods */ register(name, service) { const controller = new file_controller_1.FileController(service); this.entities.set(name, { name, service, controller }); } /** * Method responsible for returning a service * @param name Service name */ service(name) { const data = this.entities.get(name); if (!data) return; return data.service; } /** * Method responsible for returning controller * @param name Service name */ controller(name) { const data = this.entities.get(name); if (!data) return; return data.controller; } /** * List of all registered services */ get services() { return [...this.entities].map((entity) => entity[1]); } } exports.Filesrocket = Filesrocket; //# sourceMappingURL=service.js.map