@autofleet/super-express 2.0.0 → 2.1.0

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 (2) hide show
  1. package/index.d.ts +43 -0
  2. package/package.json +1 -1
package/index.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ import express from 'express';
2
+
3
+ /**
4
+ * Options to customize the behavior of the SuperExpress application.
5
+ */
6
+ export type DefaultOptions = {
7
+ /**
8
+ * Enables or disables body parser middleware.
9
+ */
10
+ bodyParser?: boolean;
11
+ // Add other options from default-options.json as needed
12
+ };
13
+
14
+ /**
15
+ * Type for the callback function used in the listen method.
16
+ */
17
+ type ListenCallback = () => void;
18
+
19
+ /**
20
+ * Extends the express.Application interface to include nativeListen and the overridden listen method.
21
+ */
22
+ export interface SuperExpressApp extends express.Application {
23
+ /**
24
+ * Original express listen method.
25
+ */
26
+ nativeListen: express.Application['listen'];
27
+
28
+ /**
29
+ * Overridden listen method to add custom behavior.
30
+ * @param port - The port number to listen on.
31
+ * @param cb - Optional callback function to execute after the server starts listening.
32
+ */
33
+ listen(port: number, cb?: ListenCallback): void;
34
+ }
35
+
36
+ /**
37
+ * Creates a new SuperExpress application with the given options.
38
+ * @param options - Optional settings to customize the application.
39
+ * @returns A SuperExpress application instance.
40
+ */
41
+ export default function createSuperExpressApp(
42
+ options?: Partial<DefaultOptions & express.ApplicationOptions>
43
+ ): SuperExpressApp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/super-express",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "AF Express with built in boilerplate",
5
5
  "main": "index.js",
6
6
  "type": "module",