framework-do-dede 1.0.1 → 1.0.2

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
@@ -10,9 +10,10 @@ export type Options = {
10
10
  middlewares?: CallableFunction[];
11
11
  };
12
12
  registries: Register[];
13
+ defaultServerError?: string;
13
14
  };
14
15
  export declare class Dede {
15
- static init({ framework, registries }: Options): Promise<void>;
16
+ static init({ framework, registries, defaultServerError }: Options): Promise<void>;
16
17
  private static clearControllers;
17
18
  private static loadRegistries;
18
19
  }
package/dist/dede.js CHANGED
@@ -3,7 +3,7 @@ import { ControllerHandler } from "./handlers";
3
3
  import { ElysiaHttpServer } from "./http/ElysiaHttpServer";
4
4
  import { ExpressHttpServer } from "./http/ExpressHttpServer";
5
5
  export class Dede {
6
- static async init({ framework, registries }) {
6
+ static async init({ framework, registries, defaultServerError }) {
7
7
  await this.loadRegistries(registries);
8
8
  let httpServer;
9
9
  if (framework.use === 'elysia') {
@@ -12,6 +12,8 @@ export class Dede {
12
12
  if (framework.use === 'express') {
13
13
  httpServer = new ExpressHttpServer(framework.middlewares || []);
14
14
  }
15
+ if (defaultServerError)
16
+ httpServer.setDefaultMessageError(defaultServerError);
15
17
  if (Registry.has('controllers')) {
16
18
  new ControllerHandler(httpServer, framework.port || 80);
17
19
  this.clearControllers();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framework-do-dede",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",