quantum-flow 1.0.4 → 1.0.6
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/README.md +16 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ yarn build
|
|
|
21
21
|
Use the `@Controller` decorator to define controllers with options such as prefix, sub-controllers, middlewares, and interceptors.
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
|
-
import { Controller } from '
|
|
24
|
+
import { Controller } from 'quantum-flow/core';
|
|
25
25
|
|
|
26
26
|
@Controller({
|
|
27
27
|
prefix: 'api',
|
|
@@ -36,7 +36,7 @@ class RootController {}
|
|
|
36
36
|
Use the `@Server` decorator with configuration options like port, host, controllers, and WebSocket enablement.
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
|
-
import { Server, Port, Host, Use, Intercept, Catch, HttpServer } from '
|
|
39
|
+
import { Server, Port, Host, Use, Intercept, Catch, HttpServer } from 'quantum-flow/http';
|
|
40
40
|
|
|
41
41
|
@Server({
|
|
42
42
|
controllers: [RootController],
|
|
@@ -62,22 +62,22 @@ server.listen().catch(console.error);
|
|
|
62
62
|
|
|
63
63
|
## Request decorators
|
|
64
64
|
|
|
65
|
-
- Use `@Body` to
|
|
66
|
-
- Use `@Headers` to
|
|
67
|
-
- Use `@Query` to handle
|
|
68
|
-
- Use `@Params`
|
|
69
|
-
- Use `@Multipart`
|
|
70
|
-
- Use `@Request`
|
|
71
|
-
- Use `@Response`
|
|
65
|
+
- Use `@Body` to handle request bodies.
|
|
66
|
+
- Use `@Headers` to access request headers.
|
|
67
|
+
- Use `@Query` to handle query parameters.
|
|
68
|
+
- Use `@Params` to access route parameters.
|
|
69
|
+
- Use `@Multipart` for handling multipart/form-data requests.
|
|
70
|
+
- Use `@Request` to access the entire request object.
|
|
71
|
+
- Use `@Response` to access the response object.
|
|
72
72
|
|
|
73
73
|
# AWS Lambda Support
|
|
74
74
|
|
|
75
75
|
Use `LambdaAdapter` to convert API Gateway events to requests and responses. Create Lambda handlers from controllers.
|
|
76
76
|
|
|
77
77
|
```typescript
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
Example Lambda handler creation
|
|
79
|
+
import { LambdaAdapter } from 'quantum-flow/aws';
|
|
80
|
+
export const handler = LambdaAdapter.createHandler(RootController);
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
# WebSocket Support
|
|
@@ -177,9 +177,9 @@ You can use controllers and server functionality by importing controllers and cr
|
|
|
177
177
|
|
|
178
178
|
# Project Structure
|
|
179
179
|
|
|
180
|
-
- `
|
|
181
|
-
- `
|
|
182
|
-
- `
|
|
180
|
+
- `quantum-flow/http` - Main application source code for HTTP servers.
|
|
181
|
+
- `quantum-flow/aws` - Main application source code AWS Lambda.
|
|
182
|
+
- `quantum-flow/core` - Core framework components like Controller and Endpoint.
|
|
183
183
|
|
|
184
184
|
---
|
|
185
185
|
|
|
@@ -246,6 +246,7 @@ class App {}
|
|
|
246
246
|
Method or class decorator to validate request parameters (query, body, params, headers) against a DTO class using class-validator.
|
|
247
247
|
|
|
248
248
|
```typescript
|
|
249
|
+
import { IsEmail } from 'class-validator';
|
|
249
250
|
class UserDTO {
|
|
250
251
|
@IsEmail()
|
|
251
252
|
email: string;
|