mysqlsyncr 1.0.56 → 1.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,379 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.startApiServer = void 0;
8
- var _express = _interopRequireDefault(require("express"));
9
- var _http = _interopRequireDefault(require("http"));
10
- var _dump = require("./dump.js");
11
- var _compare = require("./compare.js");
12
- var _index = require("./index.js");
13
- var _apply = require("./apply.js");
14
- var _cors = _interopRequireDefault(require("cors"));
15
- var _url = require("url");
16
- var _path = require("path");
17
- var _promises = require("fs/promises");
18
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
19
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
20
- function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
21
- function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } // Import necessary functions
22
- // Import your DBStructureChecker class
23
- var setConfig = function setConfig(config, argv) {
24
- if (!config.host && argv.host) {
25
- config.host = argv.host;
26
- }
27
- if (!config.port && argv.port) {
28
- config.port = argv.port;
29
- }
30
- if (!config.user && argv.user) {
31
- config.user = argv.user;
32
- }
33
- if (!config.password && argv.password) {
34
- config.password = argv.password;
35
- }
36
- if (!config.output && argv.output !== '../db-dump') {
37
- config.output = argv.output;
38
- }
39
- return config;
40
- };
41
- var startApiServer = exports.startApiServer = function startApiServer(port, argv) {
42
- var app = (0, _express["default"])();
43
- app.use((0, _cors["default"])({
44
- origin: '*'
45
- }));
46
- var server = _http["default"].createServer(app);
47
- app.use(_express["default"].json({
48
- limit: '50mb'
49
- }));
50
- app.use(_express["default"].urlencoded({
51
- limit: '50mb',
52
- extended: true
53
- }));
54
- var __dirname = process.platform === "win32" ? process.cwd().replace(/\\/g, '/') : process.cwd();
55
- app.use(_express["default"]["static"]((0, _path.join)(__dirname, '../ui/dist/spa')));
56
- app.post('/api/getDatabasesFromExistingDumps', /*#__PURE__*/function () {
57
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, res) {
58
- var config, databases;
59
- return _regeneratorRuntime().wrap(function _callee$(_context) {
60
- while (1) switch (_context.prev = _context.next) {
61
- case 0:
62
- config = req.body.config;
63
- config = setConfig(config, argv);
64
- _context.next = 4;
65
- return (0, _dump.getDatabasesFromExistingDumps)(config);
66
- case 4:
67
- databases = _context.sent;
68
- res.json(databases);
69
- case 6:
70
- case "end":
71
- return _context.stop();
72
- }
73
- }, _callee);
74
- }));
75
- return function (_x, _x2) {
76
- return _ref.apply(this, arguments);
77
- };
78
- }());
79
-
80
- // API endpoint to dump the database
81
- app.post('/api/dump', /*#__PURE__*/function () {
82
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(req, res) {
83
- var _req$body, config, database, checker;
84
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
85
- while (1) switch (_context3.prev = _context3.next) {
86
- case 0:
87
- _req$body = req.body, config = _req$body.config, database = _req$body.database;
88
- config = setConfig(config, argv);
89
- checker = new _index.DBStructureChecker(config, database);
90
- checker.connection.on('error', function (err) {
91
- console.error('Database connection error in route dump:', err);
92
- res.status(500).json({
93
- message: 'Database connection failed',
94
- error: err.message
95
- });
96
- });
97
- checker.connection.on('connect', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
98
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
99
- while (1) switch (_context2.prev = _context2.next) {
100
- case 0:
101
- console.log('Connected to the database');
102
- checker.targetDatabase = database;
103
- checker.command = 'dump';
104
- checker.options = req.body;
105
- _context2.prev = 4;
106
- console.log('Dumping the database structure to files');
107
- _context2.next = 8;
108
- return (0, _dump.dumpAllDatabases)(checker.connection, 'dump', config);
109
- case 8:
110
- res.json({
111
- message: 'Dump completed successfully'
112
- });
113
- _context2.next = 14;
114
- break;
115
- case 11:
116
- _context2.prev = 11;
117
- _context2.t0 = _context2["catch"](4);
118
- res.status(500).json({
119
- message: _context2.t0.message
120
- });
121
- case 14:
122
- _context2.prev = 14;
123
- _context2.next = 17;
124
- return checker.closeConnection();
125
- case 17:
126
- return _context2.finish(14);
127
- case 18:
128
- case "end":
129
- return _context2.stop();
130
- }
131
- }, _callee2, null, [[4, 11, 14, 18]]);
132
- })));
133
- case 5:
134
- case "end":
135
- return _context3.stop();
136
- }
137
- }, _callee3);
138
- }));
139
- return function (_x3, _x4) {
140
- return _ref2.apply(this, arguments);
141
- };
142
- }());
143
-
144
- // API endpoint to compare the database
145
- app.post('/api/compare', /*#__PURE__*/function () {
146
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(req, res) {
147
- var _req$body2, config, database, checker;
148
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
149
- while (1) switch (_context5.prev = _context5.next) {
150
- case 0:
151
- _req$body2 = req.body, config = _req$body2.config, database = _req$body2.database;
152
- config = setConfig(config, argv);
153
- checker = new _index.DBStructureChecker(config, database);
154
- checker.connection.on('error', function (err) {
155
- console.error('Database connection error in route compare:', err);
156
- res.status(500).json({
157
- message: 'Database connection failed',
158
- error: err.message
159
- });
160
- });
161
- checker.connection.on('connect', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
162
- var diffs;
163
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
164
- while (1) switch (_context4.prev = _context4.next) {
165
- case 0:
166
- console.log('Connected to the database');
167
- checker.targetDatabase = config.database;
168
- checker.command = 'compare';
169
- checker.options = req.body;
170
- _context4.prev = 4;
171
- delete req.body.output;
172
- console.log('Comparing the database structure with JSON dumps (dry run)');
173
- _context4.next = 9;
174
- return (0, _compare.compareAllDatabases)(checker.connection, config.output, false, 'compare', config);
175
- case 9:
176
- diffs = _context4.sent;
177
- res.json(diffs);
178
- _context4.next = 18;
179
- break;
180
- case 13:
181
- _context4.prev = 13;
182
- _context4.t0 = _context4["catch"](4);
183
- console.log(_context4.t0);
184
- console.log(req.body);
185
- res.status(500).json({
186
- message: _context4.t0.message
187
- });
188
- case 18:
189
- _context4.prev = 18;
190
- _context4.next = 21;
191
- return checker.closeConnection();
192
- case 21:
193
- return _context4.finish(18);
194
- case 22:
195
- case "end":
196
- return _context4.stop();
197
- }
198
- }, _callee4, null, [[4, 13, 18, 22]]);
199
- })));
200
- case 5:
201
- case "end":
202
- return _context5.stop();
203
- }
204
- }, _callee5);
205
- }));
206
- return function (_x5, _x6) {
207
- return _ref4.apply(this, arguments);
208
- };
209
- }());
210
-
211
- // API endpoint to apply differences
212
- app.post('/api/apply', /*#__PURE__*/function () {
213
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(req, res) {
214
- var _req$body3, config, database, diffs, checker;
215
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
216
- while (1) switch (_context7.prev = _context7.next) {
217
- case 0:
218
- _req$body3 = req.body, config = _req$body3.config, database = _req$body3.database, diffs = _req$body3.diffs;
219
- config = setConfig(config, argv);
220
- console.log('Applying differences:', diffs);
221
- checker = new _index.DBStructureChecker(config, database);
222
- checker.connection.on('error', function (err) {
223
- console.error('Database connection error in route apply:', err);
224
- res.status(500).json({
225
- message: 'Database connection failed',
226
- error: err.message
227
- });
228
- });
229
- checker.connection.on('connect', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
230
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
231
- while (1) switch (_context6.prev = _context6.next) {
232
- case 0:
233
- console.log('Connected to the database');
234
- checker.targetDatabase = database;
235
- checker.command = 'apply';
236
- checker.options = req.body;
237
- _context6.prev = 4;
238
- console.log('Applying the database structure based on JSON dumps');
239
- _context6.next = 8;
240
- return (0, _apply.applyDifferences)(checker.connection, database, diffs);
241
- case 8:
242
- res.json({
243
- message: 'Apply completed successfully'
244
- });
245
- _context6.next = 14;
246
- break;
247
- case 11:
248
- _context6.prev = 11;
249
- _context6.t0 = _context6["catch"](4);
250
- res.status(500).json({
251
- message: _context6.t0.message
252
- });
253
- case 14:
254
- _context6.prev = 14;
255
- _context6.next = 17;
256
- return checker.closeConnection();
257
- case 17:
258
- return _context6.finish(14);
259
- case 18:
260
- case "end":
261
- return _context6.stop();
262
- }
263
- }, _callee6, null, [[4, 11, 14, 18]]);
264
- })));
265
- case 6:
266
- case "end":
267
- return _context7.stop();
268
- }
269
- }, _callee7);
270
- }));
271
- return function (_x7, _x8) {
272
- return _ref6.apply(this, arguments);
273
- };
274
- }());
275
- app.post('/api/browse-folders', /*#__PURE__*/function () {
276
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(req, res) {
277
- var _req$body$currentPath, currentPath, resolvedPath, contents, items, sortedItems;
278
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
279
- while (1) switch (_context8.prev = _context8.next) {
280
- case 0:
281
- _context8.prev = 0;
282
- _req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === void 0 ? process.cwd() : _req$body$currentPath;
283
- console.log('Browsing folder:', currentPath);
284
- resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/) ? (0, _path.resolve)(currentPath) : (0, _path.resolve)(process.cwd(), currentPath);
285
- console.log('Resolved path:', resolvedPath);
286
- _context8.next = 7;
287
- return (0, _promises.readdir)(resolvedPath, {
288
- withFileTypes: true
289
- });
290
- case 7:
291
- contents = _context8.sent;
292
- // Separate directories and files
293
- items = contents.map(function (dirent) {
294
- return {
295
- name: dirent.name,
296
- path: (0, _path.join)(resolvedPath, dirent.name),
297
- isDirectory: dirent.isDirectory(),
298
- isParent: false
299
- };
300
- }); // Sort items: directories first, then files, both alphabetically
301
- sortedItems = items.sort(function (a, b) {
302
- if (a.isDirectory === b.isDirectory) {
303
- return a.name.localeCompare(b.name);
304
- }
305
- return a.isDirectory ? -1 : 1;
306
- }); // Add parent directory option if not at root
307
- if (resolvedPath !== (0, _path.resolve)(resolvedPath, '..')) {
308
- sortedItems.unshift({
309
- name: '..',
310
- path: (0, _path.resolve)(resolvedPath, '..'),
311
- isDirectory: true,
312
- isParent: true
313
- });
314
- }
315
- res.json({
316
- currentPath: resolvedPath,
317
- items: sortedItems
318
- });
319
- _context8.next = 17;
320
- break;
321
- case 14:
322
- _context8.prev = 14;
323
- _context8.t0 = _context8["catch"](0);
324
- res.status(500).json({
325
- error: _context8.t0.message
326
- });
327
- case 17:
328
- case "end":
329
- return _context8.stop();
330
- }
331
- }, _callee8, null, [[0, 14]]);
332
- }));
333
- return function (_x9, _x10) {
334
- return _ref8.apply(this, arguments);
335
- };
336
- }());
337
- app.post('/api/create-folder', /*#__PURE__*/function () {
338
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(req, res) {
339
- var folderPath, resolvedPath;
340
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
341
- while (1) switch (_context9.prev = _context9.next) {
342
- case 0:
343
- _context9.prev = 0;
344
- folderPath = req.body.folderPath;
345
- console.log('Creating folder:', folderPath);
346
- resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? (0, _path.resolve)(folderPath) : (0, _path.resolve)(process.cwd(), folderPath);
347
- _context9.next = 6;
348
- return (0, _promises.mkdir)(resolvedPath, {
349
- recursive: true
350
- });
351
- case 6:
352
- res.json({
353
- success: true,
354
- path: resolvedPath
355
- });
356
- _context9.next = 12;
357
- break;
358
- case 9:
359
- _context9.prev = 9;
360
- _context9.t0 = _context9["catch"](0);
361
- res.status(500).json({
362
- error: _context9.t0.message
363
- });
364
- case 12:
365
- case "end":
366
- return _context9.stop();
367
- }
368
- }, _callee9, null, [[0, 9]]);
369
- }));
370
- return function (_x11, _x12) {
371
- return _ref9.apply(this, arguments);
372
- };
373
- }());
374
-
375
- // Start the server
376
- server.listen(port, function () {
377
- console.log("Server is running on http://localhost:".concat(port));
378
- });
379
- };
File without changes