Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.startRestapifyServer = void 0; const path = require("path"); const chalk = require("chalk"); const restapify_1 = require("restapify"); const utils_1 = require("./utils"); const startRestapifyServer = (options) => { const { rootDir, port, baseUrl, openDashboard } = options; const RestapifyInstance = new restapify_1.default({ rootDir: path.resolve(rootDir), port: port, baseUrl: baseUrl, openDashboard: openDashboard }); RestapifyInstance.on('server:start', () => { console.log(`\nš Try to serve on port ${RestapifyInstance.port}`); }); RestapifyInstance.onError(({ error }) => { utils_1.onRestapifyInstanceError(error, { rootDir: RestapifyInstance.rootDir, apiBaseUrl: RestapifyInstance.apiBaseUrl, port: RestapifyInstance.port }); }); RestapifyInstance.on('start', () => { const servedRoutes = RestapifyInstance.getServedRoutes(); servedRoutes.forEach(servedRoute => { let methodOutput = utils_1.getMethodOutput(servedRoute.method); console.log(`${methodOutput} ${servedRoute.route}`); }); console.log(utils_1.getInstanceOverviewOutput(RestapifyInstance.port, RestapifyInstance.apiBaseUrl)); }); RestapifyInstance.on('server:restart', () => { console.log(chalk.green('ā API updated!')); }); RestapifyInstance.run(); }; exports.startRestapifyServer = startRestapifyServer; |