UNPKG

@backapisocket/io

Version:

A simple API framework using Flexible Persistence

25 lines 837 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const socket_io_1 = require("socket.io"); class SimpleApp { get port() { return this._port; } constructor(router, databaseHandler, port, options) { this._port = port; this.server = new socket_io_1.Server(port, options); this.middlewares(); this.router = router; this.databaseHandler = databaseHandler; this.routes(databaseHandler.getInit()); } // eslint-disable-next-line @typescript-eslint/no-empty-function middlewares() { } routes(initDefault) { this.server.on('connection', (socket) => { this.router.createRoutes.bind(this.router)(this.server, socket, initDefault); }); } } exports.default = SimpleApp; //# sourceMappingURL=simpleApp.js.map