admin_lsac 1.3.2 → 1.4.1

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.
Files changed (79) hide show
  1. package/.eslintrc.cjs +18 -0
  2. package/README.md +162 -162
  3. package/dist/src/App.d.ts +7 -0
  4. package/dist/src/App.js +10 -0
  5. package/dist/src/components/AdminPage.d.ts +8 -0
  6. package/dist/{esm/components/Page.js → src/components/AdminPage.js} +35 -43
  7. package/dist/src/components/GenericForm.d.ts +8 -0
  8. package/dist/src/components/GenericForm.js +151 -0
  9. package/dist/src/main.d.ts +1 -0
  10. package/dist/src/main.js +7 -0
  11. package/dist/{App.d.ts → src/schema.d.ts} +53 -76
  12. package/dist/src/testSchemas/event.d.ts +2 -0
  13. package/dist/src/testSchemas/event.js +86 -0
  14. package/dist/src/utils/websockets.d.ts +1 -0
  15. package/dist/{esm → src}/utils/websockets.js +5 -5
  16. package/index.html +13 -0
  17. package/package.json +42 -73
  18. package/tsconfig.app.json +27 -0
  19. package/tsconfig.json +11 -31
  20. package/tsconfig.node.json +13 -0
  21. package/vite.config.ts +7 -0
  22. package/dist/App.js +0 -12
  23. package/dist/cjs/App.js +0 -12
  24. package/dist/cjs/components/GenericForm.js +0 -305
  25. package/dist/cjs/components/Page.js +0 -119
  26. package/dist/cjs/index.js +0 -18
  27. package/dist/cjs/pages/event.js +0 -134
  28. package/dist/cjs/pages/page.js +0 -375
  29. package/dist/cjs/reportWebVitals.js +0 -38
  30. package/dist/cjs/schema/schema.config.js +0 -9
  31. package/dist/cjs/schema/schema.js +0 -2
  32. package/dist/cjs/setupTests.js +0 -7
  33. package/dist/cjs/utils/websockets.js +0 -22
  34. package/dist/components/GenericForm.js +0 -305
  35. package/dist/components/Page.js +0 -119
  36. package/dist/esm/App.js +0 -10
  37. package/dist/esm/components/GenericForm.js +0 -275
  38. package/dist/esm/index.js +0 -13
  39. package/dist/esm/pages/event.js +0 -128
  40. package/dist/esm/pages/page.js +0 -349
  41. package/dist/esm/reportWebVitals.js +0 -13
  42. package/dist/esm/schema/schema.config.js +0 -6
  43. package/dist/esm/setupTests.js +0 -5
  44. package/dist/index.js +0 -18
  45. package/dist/pages/event.js +0 -134
  46. package/dist/pages/page.js +0 -375
  47. package/dist/reportWebVitals.js +0 -38
  48. package/dist/schema/schema.config.js +0 -9
  49. package/dist/schema/schema.js +0 -2
  50. package/dist/setupTests.js +0 -7
  51. package/dist/utils/websockets.js +0 -22
  52. package/public/favicon.ico +0 -0
  53. package/public/index.html +0 -43
  54. package/public/logo192.png +0 -0
  55. package/public/logo512.png +0 -0
  56. package/public/manifest.json +0 -25
  57. package/public/robots.txt +0 -3
  58. package/server/.env.example +0 -3
  59. package/server/deploy.js +0 -29
  60. package/server/package-lock.json +0 -712
  61. package/server/package.json +0 -18
  62. package/src/App.css +0 -38
  63. package/src/App.tsx +0 -50
  64. package/src/components/GenericForm.tsx +0 -308
  65. package/src/components/Page.tsx +0 -243
  66. package/src/index.css +0 -13
  67. package/src/index.tsx +0 -20
  68. package/src/logo.svg +0 -1
  69. package/src/pages/event.ts +0 -93
  70. package/src/pages/page.ts +0 -336
  71. package/src/react-app-env.d.ts +0 -1
  72. package/src/reportWebVitals.ts +0 -15
  73. package/src/schema/schema.config.ts +0 -8
  74. package/src/schema/schema.ts +0 -63
  75. package/src/setupTests.ts +0 -5
  76. package/src/utils/websockets.tsx +0 -17
  77. package/tsconfig.esm.json +0 -7
  78. package/webpack.config.js +0 -22
  79. /package/dist/{esm/schema → src}/schema.js +0 -0
@@ -1,375 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __generator = (this && this.__generator) || function (thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
- function verb(n) { return function (v) { return step([n, v]); }; }
38
- function step(op) {
39
- if (f) throw new TypeError("Generator is already executing.");
40
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
- if (y = 0, t) op = [op[0] & 2, t.value];
43
- switch (op[0]) {
44
- case 0: case 1: t = op; break;
45
- case 4: _.label++; return { value: op[1], done: false };
46
- case 5: _.label++; y = op[1]; op = [0]; continue;
47
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
- default:
49
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
- if (t[2]) _.ops.pop();
54
- _.trys.pop(); continue;
55
- }
56
- op = body.call(thisArg, _);
57
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
- }
60
- };
61
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
62
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
63
- if (ar || !(i in from)) {
64
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
65
- ar[i] = from[i];
66
- }
67
- }
68
- return to.concat(ar || Array.prototype.slice.call(from));
69
- };
70
- Object.defineProperty(exports, "__esModule", { value: true });
71
- exports.page = void 0;
72
- var Yup = __importStar(require("yup"));
73
- var typeAdding = function (objectField) {
74
- objectField.type = "object";
75
- objectField.fields = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], objectField.simpleFields, true), objectField.dropdownFields, true), objectField.objectFields, true), objectField.arrayFields, true);
76
- if (objectField.objectFields) {
77
- objectField.objectFields.map(function (objectField) {
78
- objectField = typeAdding(objectField);
79
- return objectField;
80
- });
81
- }
82
- if (objectField.arrayFields) {
83
- objectField.arrayFields.map(function (arrayField) {
84
- arrayField.element = typeAdding(arrayField.element);
85
- return arrayField;
86
- });
87
- }
88
- return objectField;
89
- };
90
- var arrayObjs = function (x) {
91
- if (x > 0)
92
- return [
93
- {
94
- name: "simpleFields",
95
- label: "Type SimpleField",
96
- type: "array",
97
- element: {
98
- name: "",
99
- label: "",
100
- type: "object",
101
- fields: [
102
- {
103
- name: "name",
104
- label: "Name",
105
- type: "string",
106
- validationSchema: Yup.string().required(),
107
- },
108
- {
109
- name: "label",
110
- label: "Label",
111
- type: "string",
112
- validationSchema: Yup.string().required(),
113
- },
114
- {
115
- name: "type",
116
- label: "Type",
117
- type: "string",
118
- validationSchema: Yup.string().required(),
119
- },
120
- {
121
- name: "validationSchema",
122
- label: "Validation Schema",
123
- type: "string",
124
- validationSchema: Yup.string().required(),
125
- },
126
- ],
127
- },
128
- },
129
- {
130
- name: "dropdownFields",
131
- label: "Type DropdownField",
132
- type: "array",
133
- element: {
134
- name: "",
135
- label: "",
136
- type: "object",
137
- fields: [
138
- {
139
- name: "name",
140
- label: "Name",
141
- type: "string",
142
- validationSchema: Yup.string().required(),
143
- },
144
- {
145
- name: "label",
146
- label: "Label",
147
- type: "string",
148
- validationSchema: Yup.string().required(),
149
- },
150
- {
151
- name: "options",
152
- label: "Options",
153
- type: "array",
154
- element: {
155
- name: "",
156
- label: "",
157
- type: "object",
158
- fields: [
159
- {
160
- name: "value",
161
- label: "Value",
162
- type: "string",
163
- validationSchema: Yup.string().required(),
164
- },
165
- {
166
- name: "display",
167
- label: "Display",
168
- type: "string",
169
- validationSchema: Yup.string().required(),
170
- },
171
- ],
172
- },
173
- },
174
- {
175
- name: "getOptions",
176
- label: "GetOptions Function",
177
- type: "string",
178
- validationSchema: Yup.string().required(),
179
- },
180
- ],
181
- },
182
- },
183
- {
184
- name: "objectFields",
185
- label: "Type ObjectField",
186
- type: "array",
187
- element: {
188
- name: "",
189
- label: "",
190
- type: "object",
191
- fields: __spreadArray([
192
- {
193
- name: "name",
194
- label: "Name",
195
- type: "string",
196
- validationSchema: Yup.string().required(),
197
- },
198
- {
199
- name: "label",
200
- label: "Label",
201
- type: "string",
202
- validationSchema: Yup.string().required(),
203
- }
204
- ], arrayObjs(x - 1), true),
205
- },
206
- },
207
- {
208
- name: "arrayFields",
209
- label: "Type ArrayField",
210
- type: "array",
211
- element: {
212
- name: "",
213
- label: "",
214
- type: "object",
215
- fields: __spreadArray([
216
- {
217
- name: "name",
218
- label: "Name",
219
- type: "string",
220
- validationSchema: Yup.string().required(),
221
- },
222
- {
223
- name: "label",
224
- label: "Label",
225
- type: "string",
226
- validationSchema: Yup.string().required(),
227
- }
228
- ], arrayObjs(x - 1), true),
229
- },
230
- },
231
- ];
232
- else
233
- return [];
234
- };
235
- exports.page = {
236
- name: "Pages",
237
- getRequest: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
238
- return [2 /*return*/, []];
239
- }); }); },
240
- tableFields: [],
241
- actions: [
242
- {
243
- name: "Create New Page",
244
- fields: [
245
- {
246
- name: "name",
247
- label: "Page Name",
248
- type: "string",
249
- validationSchema: Yup.string().required(),
250
- },
251
- {
252
- name: "getRequest",
253
- label: "GetRequest",
254
- type: "string",
255
- validationSchema: Yup.string().required(),
256
- },
257
- {
258
- name: "tableFields",
259
- label: "TableFields",
260
- type: "array",
261
- element: {
262
- name: "",
263
- label: "",
264
- type: "object",
265
- fields: [
266
- {
267
- name: "name",
268
- label: "TableField Name",
269
- type: "string",
270
- validationSchema: Yup.string().required(),
271
- },
272
- {
273
- name: "access",
274
- label: "TableField Access Function",
275
- type: "string",
276
- validationSchema: Yup.string().required(),
277
- },
278
- ],
279
- },
280
- },
281
- {
282
- name: "actions",
283
- label: "Actions",
284
- type: "array",
285
- element: {
286
- name: "",
287
- label: "",
288
- type: "object",
289
- fields: __spreadArray(__spreadArray([
290
- {
291
- name: "name",
292
- label: "Action Name",
293
- type: "string",
294
- validationSchema: Yup.string().required(),
295
- }
296
- ], arrayObjs(4), true), [
297
- {
298
- name: "onSubmit",
299
- label: "Action OnSubmit Function",
300
- type: "string",
301
- validationSchema: Yup.string().required(),
302
- },
303
- ], false),
304
- },
305
- },
306
- {
307
- name: "rowActions",
308
- label: "Row Actions",
309
- type: "array",
310
- element: {
311
- name: "",
312
- label: "",
313
- type: "object",
314
- fields: __spreadArray(__spreadArray([
315
- {
316
- name: "name",
317
- label: "Row Action Name",
318
- type: "string",
319
- validationSchema: Yup.string().required(),
320
- }
321
- ], arrayObjs(4), true), [
322
- {
323
- name: "initialise",
324
- label: "Row Action Initialise Function",
325
- type: "string",
326
- validationSchema: "",
327
- },
328
- {
329
- name: "onSubmit",
330
- label: "Row Action OnSubmit Function",
331
- type: "string",
332
- validationSchema: Yup.string().required(),
333
- },
334
- ], false),
335
- },
336
- },
337
- ],
338
- onSubmit: function (formValues) { return __awaiter(void 0, void 0, void 0, function () {
339
- return __generator(this, function (_a) {
340
- if (Array.isArray(formValues.actions))
341
- formValues.actions.map(function (action) {
342
- var _a, _b, _c;
343
- (_a = action.dropdownFields) === null || _a === void 0 ? void 0 : _a.map(function (actionField) { return (actionField.type = "dropdown"); });
344
- (_b = action.objectFields) === null || _b === void 0 ? void 0 : _b.map(function (actionField) { return (actionField = typeAdding(actionField)); });
345
- (_c = action.arrayFields) === null || _c === void 0 ? void 0 : _c.map(function (actionField) {
346
- actionField.type = "array";
347
- actionField.element = typeAdding(actionField.element);
348
- return actionField;
349
- });
350
- action.fields = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], action.simpleFields, true), action.dropdownFields, true), action.objectFields, true), action.arrayFields, true);
351
- return action;
352
- });
353
- if (Array.isArray(formValues.rowActions))
354
- formValues.actions.map(function (rowAction) {
355
- var _a, _b, _c;
356
- (_a = rowAction.dropdownFields) === null || _a === void 0 ? void 0 : _a.map(function (rowActionField) { return (rowActionField.type = "dropdown"); });
357
- (_b = rowAction.objectFields) === null || _b === void 0 ? void 0 : _b.map(function (rowActionField) {
358
- return (rowActionField = typeAdding(rowActionField));
359
- });
360
- (_c = rowAction.arrayFields) === null || _c === void 0 ? void 0 : _c.map(function (rowActionField) {
361
- rowActionField.type = "array";
362
- rowActionField.element = typeAdding(rowActionField.element);
363
- return rowActionField;
364
- });
365
- rowAction.fields = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], rowAction.simpleFields, true), rowAction.dropdownFields, true), rowAction.objectFields, true), rowAction.arrayFields, true);
366
- return rowAction;
367
- });
368
- console.log(formValues);
369
- return [2 /*return*/, []];
370
- });
371
- }); },
372
- },
373
- ],
374
- rowActions: [],
375
- };
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- var reportWebVitals = function (onPerfEntry) {
27
- if (onPerfEntry && onPerfEntry instanceof Function) {
28
- Promise.resolve().then(function () { return __importStar(require("web-vitals")); }).then(function (_a) {
29
- var getCLS = _a.getCLS, getFID = _a.getFID, getFCP = _a.getFCP, getLCP = _a.getLCP, getTTFB = _a.getTTFB;
30
- getCLS(onPerfEntry);
31
- getFID(onPerfEntry);
32
- getFCP(onPerfEntry);
33
- getLCP(onPerfEntry);
34
- getTTFB(onPerfEntry);
35
- });
36
- }
37
- };
38
- exports.default = reportWebVitals;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pages = void 0;
4
- var event_1 = require("../pages/event");
5
- var page_1 = require("../pages/page");
6
- exports.pages = [
7
- event_1.event, // example schema
8
- page_1.page,
9
- ];
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // jest-dom adds custom jest matchers for asserting on DOM nodes.
4
- // allows you to do things like:
5
- // expect(element).toHaveTextContent(/react/i)
6
- // learn more: https://github.com/testing-library/jest-dom
7
- require("@testing-library/jest-dom");
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.newSocket = void 0;
7
- var socket_io_client_1 = __importDefault(require("socket.io-client"));
8
- var react_1 = require("react");
9
- var Socket = function (setSocket, apiURL) {
10
- (0, react_1.useEffect)(function () {
11
- var socketRef = (0, socket_io_client_1.default)(apiURL, {
12
- transports: ["websocket"],
13
- });
14
- setSocket(socketRef);
15
- return function () {
16
- socketRef.removeAllListeners();
17
- socketRef.disconnect();
18
- };
19
- }, []);
20
- };
21
- var newSocket = function (setSocket, apiURL) { return Socket(setSocket, apiURL); };
22
- exports.newSocket = newSocket;
Binary file
package/public/index.html DELETED
@@ -1,43 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <meta name="theme-color" content="#000000" />
8
- <meta
9
- name="description"
10
- content="Web site created using create-react-app"
11
- />
12
- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
- <!--
14
- manifest.json provides metadata used when your web app is installed on a
15
- user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
- -->
17
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
- <!--
19
- Notice the use of %PUBLIC_URL% in the tags above.
20
- It will be replaced with the URL of the `public` folder during the build.
21
- Only files inside the `public` folder can be referenced from the HTML.
22
-
23
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
- work correctly both with client-side routing and a non-root public URL.
25
- Learn how to configure a non-root public URL by running `npm run build`.
26
- -->
27
- <title>React App</title>
28
- </head>
29
- <body>
30
- <noscript>You need to enable JavaScript to run this app.</noscript>
31
- <div id="root"></div>
32
- <!--
33
- This HTML file is a template.
34
- If you open it directly in the browser, you will see an empty page.
35
-
36
- You can add webfonts, meta tags, or analytics to this file.
37
- The build step will place the bundled scripts into the <body> tag.
38
-
39
- To begin the development, run `npm start` or `yarn start`.
40
- To create a production bundle, use `npm run build` or `yarn build`.
41
- -->
42
- </body>
43
- </html>
Binary file
Binary file
@@ -1,25 +0,0 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "64x64 32x32 24x24 16x16",
8
- "type": "image/x-icon"
9
- },
10
- {
11
- "src": "logo192.png",
12
- "type": "image/png",
13
- "sizes": "192x192"
14
- },
15
- {
16
- "src": "logo512.png",
17
- "type": "image/png",
18
- "sizes": "512x512"
19
- }
20
- ],
21
- "start_url": ".",
22
- "display": "standalone",
23
- "theme_color": "#000000",
24
- "background_color": "#ffffff"
25
- }
package/public/robots.txt DELETED
@@ -1,3 +0,0 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow:
@@ -1,3 +0,0 @@
1
- PORT=
2
- SSL_PRIVATE_KEY_PATH=
3
- SSL_CERT_PATH=
package/server/deploy.js DELETED
@@ -1,29 +0,0 @@
1
- require('dotenv').config();
2
- const fs = require('fs');
3
- const https = require('https');
4
- const express = require('express');
5
- const path = require("path");
6
-
7
- const app = express();
8
-
9
- https.createServer({
10
- key: fs.readFileSync(process.env.SSL_PRIVATE_KEY_PATH),
11
- cert: fs.readFileSync(process.env.SSL_CERT_PATH),
12
- }, app).listen(process.env.PORT, function() {
13
- console.log('App listening on port ' + process.env.PORT + '!');
14
- });
15
-
16
- app.use(express.static(path.join(__dirname, "../", "build")));
17
-
18
- app.get('*', (req, res) => {
19
- res.sendFile(path.resolve(__dirname, '../build', 'index.html'));
20
- });
21
-
22
- app.enable('trust proxy');
23
-
24
- app.use(function(req, res, next) {
25
- if (req.secure) {
26
- return next();
27
- }
28
- res.redirect('https://' + req.headers.host + req.url);
29
- })