framework-do-dede 2.0.7 → 2.0.9
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/dist/dede.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export type Options = {
|
|
|
14
14
|
};
|
|
15
15
|
export declare class Dede {
|
|
16
16
|
private static httpServer;
|
|
17
|
-
static
|
|
18
|
-
static
|
|
17
|
+
static start({ framework, registries, defaultServerError }: Options): Promise<Dede>;
|
|
18
|
+
static stop(): Promise<void>;
|
|
19
19
|
private static clearControllers;
|
|
20
20
|
private static loadRegistries;
|
|
21
21
|
}
|
package/dist/dede.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ElysiaHttpServer } from "./http/ElysiaHttpServer";
|
|
|
4
4
|
import { ExpressHttpServer } from "./http/ExpressHttpServer";
|
|
5
5
|
export class Dede {
|
|
6
6
|
static httpServer;
|
|
7
|
-
static async
|
|
7
|
+
static async start({ framework, registries, defaultServerError }) {
|
|
8
8
|
await this.loadRegistries(registries);
|
|
9
9
|
if (framework.use === 'elysia') {
|
|
10
10
|
Dede.httpServer = new ElysiaHttpServer(framework.middlewares || []);
|
|
@@ -14,13 +14,14 @@ export class Dede {
|
|
|
14
14
|
}
|
|
15
15
|
if (defaultServerError)
|
|
16
16
|
Dede.httpServer.setDefaultMessageError(defaultServerError);
|
|
17
|
-
if (Registry.has('controllers')) {
|
|
18
|
-
new
|
|
19
|
-
this.clearControllers();
|
|
17
|
+
if (!Registry.has('controllers')) {
|
|
18
|
+
throw new Error("No controllers registered");
|
|
20
19
|
}
|
|
20
|
+
new ControllerHandler(Dede.httpServer, framework.port || 80);
|
|
21
|
+
this.clearControllers();
|
|
21
22
|
return Dede;
|
|
22
23
|
}
|
|
23
|
-
static async
|
|
24
|
+
static async stop() {
|
|
24
25
|
await Dede.httpServer.close();
|
|
25
26
|
}
|
|
26
27
|
static clearControllers() {
|