5htp-core 0.5.1-9 → 0.5.1-91
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.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "5htp-core",
|
|
3
3
|
"description": "Convenient TypeScript framework designed for Performance and Productivity.",
|
|
4
|
-
"version": "0.5.1-
|
|
4
|
+
"version": "0.5.1-91",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/5htp-core.git",
|
|
7
7
|
"license": "MIT",
|
|
@@ -58,7 +58,7 @@ export class ApplicationContainer<
|
|
|
58
58
|
},
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
public start( ApplicationClass: typeof Application ) {
|
|
61
|
+
public start( ApplicationClass: typeof Application ): Application {
|
|
62
62
|
|
|
63
63
|
// Instanciate Application
|
|
64
64
|
try {
|
|
@@ -75,6 +75,8 @@ export class ApplicationContainer<
|
|
|
75
75
|
this.handleBug(error, "Failed to start the Application");
|
|
76
76
|
process.exit(1);
|
|
77
77
|
}
|
|
78
|
+
|
|
79
|
+
return this.application;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
public async handleBug( rejection: Error, message: string, request?: ServerRequest ) {
|
package/src/server/app/index.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
- DEPENDANCES
|
|
3
3
|
----------------------------------*/
|
|
4
4
|
|
|
5
|
+
// Npm
|
|
6
|
+
import type express from 'express';
|
|
7
|
+
|
|
5
8
|
// Core
|
|
6
9
|
import AppContainer from './container';
|
|
7
10
|
import ApplicationService, { StartedServicesIndex } from './service';
|
|
@@ -42,7 +45,7 @@ export const Service = ServicesContainer;
|
|
|
42
45
|
/*----------------------------------
|
|
43
46
|
- FUNCTIONS
|
|
44
47
|
----------------------------------*/
|
|
45
|
-
export class Application<
|
|
48
|
+
export abstract class Application<
|
|
46
49
|
TServicesContainer extends ServicesContainerClass = ServicesContainerClass
|
|
47
50
|
> extends ApplicationService<Config, Hooks, /* TODO: this ? */Application, {}> {
|
|
48
51
|
|
|
@@ -190,6 +193,9 @@ export class Application<
|
|
|
190
193
|
/*----------------------------------
|
|
191
194
|
- ERROR HANDLING
|
|
192
195
|
----------------------------------*/
|
|
196
|
+
|
|
197
|
+
public abstract handleRequest( req: express.Request, res: express.Response );
|
|
198
|
+
|
|
193
199
|
// Default error handler
|
|
194
200
|
public async reportBug( bug: ServerBug ) {
|
|
195
201
|
|
package/src/server/index.ts
CHANGED
|
@@ -206,21 +206,12 @@ export default class HttpServer {
|
|
|
206
206
|
/*----------------------------------
|
|
207
207
|
- BOOT SERVICES
|
|
208
208
|
----------------------------------*/
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
await GeoTracking.ChargerCache();
|
|
216
|
-
|
|
217
|
-
await QueryParser.prebuildCache();*/
|
|
218
|
-
// Si le HMR est activé, app sera englobée dans une autre instance express
|
|
219
|
-
// Impossible donc de créer un serveur http ici, on le fera dans start.js
|
|
220
|
-
console.info("Lancement du serveur web");
|
|
221
|
-
this.http.listen(this.config.port, () => {
|
|
222
|
-
console.info(`Web server ready on ${this.publicUrl}`);
|
|
223
|
-
});
|
|
209
|
+
if (!this.router.config.serverless) {
|
|
210
|
+
console.info("Lancement du serveur web");
|
|
211
|
+
this.http.listen(this.config.port, () => {
|
|
212
|
+
console.info(`Web server ready on ${this.publicUrl}`);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
224
215
|
|
|
225
216
|
}
|
|
226
217
|
|
|
@@ -85,12 +85,13 @@ export type Config<
|
|
|
85
85
|
> = {
|
|
86
86
|
|
|
87
87
|
debug: boolean,
|
|
88
|
+
serverless?: boolean,
|
|
88
89
|
|
|
89
90
|
disk?: string, // Disk driver ID
|
|
90
91
|
|
|
91
92
|
domains: TDomainsList,
|
|
92
93
|
|
|
93
|
-
http: HttpServiceConfig
|
|
94
|
+
http: HttpServiceConfig,
|
|
94
95
|
|
|
95
96
|
context: (
|
|
96
97
|
request: ServerRequest<ServerRouter>,
|