turbo-express-js 1.0.10 → 1.0.11

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 (3) hide show
  1. package/README.md +6 -6
  2. package/index.d.ts +83 -84
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  > Made with ❤️ by Mike Karypidis
9
9
 
10
-
10
+ ---
11
11
 
12
12
  ## ✨ Features
13
13
 
@@ -21,7 +21,7 @@
21
21
 
22
22
  ---
23
23
 
24
-
24
+ ---
25
25
 
26
26
  ## 🔧 Installation
27
27
 
@@ -31,7 +31,7 @@ To install TurboServer, simply run the following command:
31
31
  npm install turbo-express-js
32
32
  ```
33
33
 
34
-
34
+ ---
35
35
 
36
36
  ## 👌 Getting Started
37
37
 
@@ -52,7 +52,7 @@ Here's a simple example of how to create a basic server using TurboServer:
52
52
  });
53
53
  ```
54
54
 
55
-
55
+ ---
56
56
 
57
57
  # 🔬 Comparison: Express.js vs Turbo Express JS
58
58
 
@@ -69,7 +69,7 @@ Here's a simple example of how to create a basic server using TurboServer:
69
69
  | Locales (i18n) | ❌ | ✅ |
70
70
  | Performance Focus | ✅ | ✅ |
71
71
 
72
-
72
+ ---
73
73
 
74
74
  ## 📦 TypeScript Support
75
75
 
@@ -103,7 +103,7 @@ app.listen(3000, () => {
103
103
  });
104
104
  ```
105
105
 
106
-
106
+ ---
107
107
 
108
108
  # Clustering
109
109
 
package/index.d.ts CHANGED
@@ -1,9 +1,52 @@
1
- // index.d.ts
2
1
  /// <reference types="node" />
3
2
 
4
3
  import { IncomingMessage, ServerResponse } from "http";
5
4
 
6
- export = TurboServer;
5
+ // Auto-imported types for req, res in route callbacks
6
+ export interface RequestInterface {
7
+ IncomingMessage: import("http").IncomingMessage;
8
+ content_type: string;
9
+ current_locale: string;
10
+ ValidationError: any;
11
+ bodyFetched: boolean;
12
+
13
+ params(): Map<string, any>;
14
+ paramsObj(): Record<string, any>;
15
+ queries(): URLSearchParams;
16
+ queriesObj(): Record<string, any>;
17
+ headers(): Record<string, string | string[] | undefined>;
18
+ method(): string;
19
+ url(): string;
20
+ httpVersion(): string;
21
+ remoteAddress(): string;
22
+ remotePort(): number;
23
+ localAddress(): string;
24
+ localPort(): number;
25
+
26
+ body(): Promise<any>;
27
+ body_hash(): any;
28
+ files(): any[];
29
+
30
+ setState(key: string, value: any): void;
31
+ useState(key: string): any;
32
+ getStateObj(): Record<string, any>;
33
+
34
+ getText(key: string): string | null;
35
+ }
36
+
37
+ export interface ResponseInterface {
38
+ OutgoingMessage: import("http").ServerResponse;
39
+
40
+ status(code: number): this;
41
+ send(body: string, contentType?: string): void;
42
+ json(data: object): void;
43
+ header(key: string, value: string): void;
44
+ }
45
+ export type TurboExpressCallback = (
46
+ req: RequestInterface,
47
+ res: ResponseInterface,
48
+ next?: Function
49
+ ) => void;
7
50
 
8
51
  declare class TurboServer {
9
52
  constructor(clusterslength?: number);
@@ -28,26 +71,26 @@ declare class TurboServer {
28
71
 
29
72
  Request: typeof RequestInterface;
30
73
  Response: typeof ResponseInterface;
31
-
32
- use(path: string, ...callbacks: Function[]): void;
33
- useEndMiddleware(path: string, ...callbacks: Function[]): void;
34
-
35
- get(path: string, ...callbacks: Function[]): void;
36
- post(path: string, ...callbacks: Function[]): void;
37
- put(path: string, ...callbacks: Function[]): void;
38
- delete(path: string, ...callbacks: Function[]): void;
39
- head(path: string, ...callbacks: Function[]): void;
40
- patch(path: string, ...callbacks: Function[]): void;
41
- options(path: string, ...callbacks: Function[]): void;
42
- link(path: string, ...callbacks: Function[]): void;
43
- unlink(path: string, ...callbacks: Function[]): void;
44
- view(path: string, ...callbacks: Function[]): void;
45
- lock(path: string, ...callbacks: Function[]): void;
46
- unlock(path: string, ...callbacks: Function[]): void;
47
- copy(path: string, ...callbacks: Function[]): void;
48
- purge(path: string, ...callbacks: Function[]): void;
49
- propfind(path: string, ...callbacks: Function[]): void;
50
- all(path: string, ...callbacks: Function[]): void;
74
+
75
+ use(path: string, ...callbacks: TurboExpressCallback[]): void;
76
+ useEndMiddleware(path: string, ...callbacks: TurboExpressCallback[]): void;
77
+
78
+ get(path: string, ...callbacks: TurboExpressCallback[]): void;
79
+ post(path: string, ...callbacks: TurboExpressCallback[]): void;
80
+ put(path: string, ...callbacks: TurboExpressCallback[]): void;
81
+ delete(path: string, ...callbacks: TurboExpressCallback[]): void;
82
+ head(path: string, ...callbacks: TurboExpressCallback[]): void;
83
+ patch(path: string, ...callbacks: TurboExpressCallback[]): void;
84
+ options(path: string, ...callbacks: TurboExpressCallback[]): void;
85
+ link(path: string, ...callbacks: TurboExpressCallback[]): void;
86
+ unlink(path: string, ...callbacks: TurboExpressCallback[]): void;
87
+ view(path: string, ...callbacks: TurboExpressCallback[]): void;
88
+ lock(path: string, ...callbacks: TurboExpressCallback[]): void;
89
+ unlock(path: string, ...callbacks: TurboExpressCallback[]): void;
90
+ copy(path: string, ...callbacks: TurboExpressCallback[]): void;
91
+ purge(path: string, ...callbacks: TurboExpressCallback[]): void;
92
+ propfind(path: string, ...callbacks: TurboExpressCallback[]): void;
93
+ all(path: string, ...callbacks: TurboExpressCallback[]): void;
51
94
 
52
95
  getServer(): import("http").Server;
53
96
  setLocales(localeDirectory: string): void;
@@ -57,68 +100,24 @@ declare class TurboServer {
57
100
 
58
101
  declare class Router {
59
102
  constructor(path?: string);
60
-
61
- get(path: string, ...callbacks: Function[]): void;
62
- post(path: string, ...callbacks: Function[]): void;
63
- put(path: string, ...callbacks: Function[]): void;
64
- delete(path: string, ...callbacks: Function[]): void;
65
- head(path: string, ...callbacks: Function[]): void;
66
- patch(path: string, ...callbacks: Function[]): void;
67
- options(path: string, ...callbacks: Function[]): void;
68
- link(path: string, ...callbacks: Function[]): void;
69
- unlink(path: string, ...callbacks: Function[]): void;
70
- view(path: string, ...callbacks: Function[]): void;
71
- lock(path: string, ...callbacks: Function[]): void;
72
- unlock(path: string, ...callbacks: Function[]): void;
73
- copy(path: string, ...callbacks: Function[]): void;
74
- purge(path: string, ...callbacks: Function[]): void;
75
- propfind(path: string, ...callbacks: Function[]): void;
76
-
77
- use(path: string, ...callbacks: Function[]): void;
78
- }
79
103
 
80
- declare class RequestInterface {
81
- IncomingMessage: IncomingMessage;
82
- models: Map<string, any>;
83
- content_type: string;
84
- current_locale: string;
85
- ValidationError: any;
86
- _body: Buffer;
87
- _files: any[];
88
- _validations: any[];
89
- _validation_errors: any[];
90
- _body_hash: any;
91
-
92
- params(): Map<string, any>;
93
- paramsObj(): Record<string, any>;
94
- queries(): URLSearchParams;
95
- queriesObj(): Record<string, any>;
96
- headers(): IncomingMessage["headers"];
97
- method(): string;
98
- url(): string;
99
- httpVersion(): string;
100
- remoteAddress(): string;
101
- remotePort(): number;
102
- localAddress(): string;
103
- localPort(): number;
104
-
105
- body(): Promise<any>;
106
- body_hash(): any;
107
- files(): any[];
108
-
109
- setState(key: string, value: any): void;
110
- useState(key: string): any;
111
- getStateObj(): Record<string, any>;
112
-
113
- getText(key: string): string | null;
104
+ get(path: string, ...callbacks: TurboExpressCallback[]): void;
105
+ post(path: string, ...callbacks: TurboExpressCallback[]): void;
106
+ put(path: string, ...callbacks: TurboExpressCallback[]): void;
107
+ delete(path: string, ...callbacks: TurboExpressCallback[]): void;
108
+ head(path: string, ...callbacks: TurboExpressCallback[]): void;
109
+ patch(path: string, ...callbacks: TurboExpressCallback[]): void;
110
+ options(path: string, ...callbacks: TurboExpressCallback[]): void;
111
+ link(path: string, ...callbacks: TurboExpressCallback[]): void;
112
+ unlink(path: string, ...callbacks: TurboExpressCallback[]): void;
113
+ view(path: string, ...callbacks: TurboExpressCallback[]): void;
114
+ lock(path: string, ...callbacks: TurboExpressCallback[]): void;
115
+ unlock(path: string, ...callbacks: TurboExpressCallback[]): void;
116
+ copy(path: string, ...callbacks: TurboExpressCallback[]): void;
117
+ purge(path: string, ...callbacks: TurboExpressCallback[]): void;
118
+ propfind(path: string, ...callbacks: TurboExpressCallback[]): void;
119
+
120
+ use(path: string, ...callbacks: TurboExpressCallback[]): void;
114
121
  }
115
122
 
116
- declare class ResponseInterface {
117
- OutgoingMessage: ServerResponse;
118
- models: Map<string, any>;
119
-
120
- status(code: number): this;
121
- send(body: string, contentType?: string): void;
122
- json(data: object): void;
123
- header(key: string, value: string): void;
124
- }
123
+ export = TurboServer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turbo-express-js",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Turbo Express JS - Performance, Security, Easy-to-use Web Server Framework",
5
5
  "main": "index.js",
6
6
  "directories": {