exodus-framework 2.0.797 → 2.0.798
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.
@@ -6,7 +6,7 @@ declare class ExpressService extends Service {
|
|
6
6
|
private server;
|
7
7
|
private mainRouter;
|
8
8
|
onServiceClusterInit(): Promise<void>;
|
9
|
-
createExpress(): Promise<
|
9
|
+
createExpress(): Promise<unknown>;
|
10
10
|
getHttpServer(): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
11
11
|
sendResponse(objResponse: THttpResponse, res: Response, next?: NextFunction): void;
|
12
12
|
responseTypeMiddleware(req: Request, res: Response, next: NextFunction): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/services/express.ts"],"names":[],"mappings":"AACA,OAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGlE,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAI7B,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAqB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGrE,cAAM,cAAe,SAAQ,OAAO;IAClC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,UAAU,CAAS;IAEd,oBAAoB;IAG3B,aAAa;
|
1
|
+
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/services/express.ts"],"names":[],"mappings":"AACA,OAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGlE,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAI7B,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAqB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGrE,cAAM,cAAe,SAAQ,OAAO;IAClC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,UAAU,CAAS;IAEd,oBAAoB;IAG3B,aAAa;IA0BnB,aAAa;IAIb,YAAY,CAAC,WAAW,EAAE,aAAa,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,YAAY;IAiC3E,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY;IAMtE,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAWzC,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY;IAUtF,2BAA2B,QACpB,GAAG,OACH,OAAO,OACP,QAAQ,KAEV,YAAY,mBAoBf;IAEI,YAAY,CAAC,MAAM,EAAE,MAAM;IAyBjC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM;CAGrC;AAED,eAAe,cAAc,CAAC"}
|
package/lib/services/express.js
CHANGED
@@ -26,33 +26,36 @@ class ExpressService extends _service.default {
|
|
26
26
|
await this.createExpress();
|
27
27
|
}
|
28
28
|
async createExpress() {
|
29
|
-
|
29
|
+
return new Promise(resolve => {
|
30
|
+
if (!this.mainRouter) throw new Error('Need router'); //!sem router
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
32
|
+
const expss = (0, _express.default)();
|
33
|
+
this.server = http.createServer(expss);
|
34
|
+
expss.use('/public', _express.default.static(_core.default.settings.getHttp().publicPath));
|
35
|
+
expss.use((0, _expressRequestsLogger.default)({
|
36
|
+
logger: (0, _logger.default)()
|
37
|
+
}));
|
38
|
+
expss.set('query parser', str => _qs.default.parse(str));
|
39
|
+
expss.use(this.responseTypeMiddleware.bind(this));
|
40
|
+
expss.use(_express.default.json({
|
41
|
+
limit: '10mb'
|
42
|
+
}));
|
43
|
+
expss.use(_express.default.urlencoded({
|
44
|
+
extended: true,
|
45
|
+
limit: '10mb'
|
46
|
+
}));
|
47
|
+
expss.use((0, _cors.default)({
|
48
|
+
origin: '*'
|
49
|
+
}));
|
50
|
+
expss.use(this.mainRouter);
|
51
|
+
expss.use(this.handleAuthorizationFailure.bind(this));
|
52
|
+
expss.use(this.handleNotFoud.bind(this));
|
53
|
+
expss.use(this.handleRequestProcessFailure.bind(this));
|
54
|
+
this.server.listen(_core.default.settings.getAppication().port, () => {
|
55
|
+
(0, _logger.default)().info(`servidor iniciado na porta: ${_core.default.settings.getAppication().port}`);
|
56
|
+
this.log(`🌍 Http Server Listering On: ${_core.default.settings.getAppication().port}`, 'success');
|
57
|
+
resolve(true);
|
58
|
+
});
|
56
59
|
});
|
57
60
|
}
|
58
61
|
getHttpServer() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/services/file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAKrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,cAAM,WAAY,SAAQ,OAAO;IACzB,aAAa;
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/services/file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAKrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,cAAM,WAAY,SAAQ,OAAO;IACzB,aAAa;YAIL,UAAU;YAKV,SAAS;IASjB,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAAiB;IAavD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAAiB;IAW/D,SAAS,CAAC,MAAM,EAAE,MAAM,iBAAiB,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI;CAIxE;AACD,eAAe,WAAW,CAAC"}
|
package/lib/services/file.js
CHANGED
@@ -14,8 +14,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
15
15
|
class FileService extends _service.default {
|
16
16
|
async onServiceInit() {
|
17
|
-
await this.checkPaths();
|
18
|
-
await this.cleanTemp();
|
17
|
+
await Promise.all([this.checkPaths(), this.cleanTemp()]);
|
19
18
|
}
|
20
19
|
async checkPaths() {
|
21
20
|
for (const path of Object.values(_app.Core.settings.getAppication().filePaths)) {
|
@@ -26,12 +25,12 @@ class FileService extends _service.default {
|
|
26
25
|
}
|
27
26
|
async cleanTemp() {
|
28
27
|
this.listFiles('temporary', files => {
|
29
|
-
|
28
|
+
for (const file of files) {
|
30
29
|
const p = _app.Core.settings.getAppication().filePaths.temporary + '/' + file;
|
31
30
|
fs.rmSync(p, {
|
32
31
|
recursive: true
|
33
32
|
});
|
34
|
-
}
|
33
|
+
}
|
35
34
|
});
|
36
35
|
}
|
37
36
|
async save(filename, destiny) {
|