@tsed/platform-serverless-http 6.100.3 → 6.102.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/platform-serverless-http",
3
- "version": "6.100.3",
3
+ "version": "6.102.2",
4
4
  "description": "Module to support Serverless HTTP function with Ts.ED",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/cjs/index.js",
@@ -54,21 +54,21 @@
54
54
  "tslib": "2.2.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@tsed/common": "6.100.3",
58
- "@tsed/core": "6.100.3",
59
- "@tsed/di": "6.100.3",
60
- "@tsed/platform-serverless-testing": "6.100.3",
57
+ "@tsed/common": "6.102.2",
58
+ "@tsed/core": "6.102.2",
59
+ "@tsed/di": "6.102.2",
60
+ "@tsed/platform-serverless-testing": "6.102.2",
61
61
  "aws-lambda": "^1.0.7",
62
62
  "serverless-http": "^2.7.0"
63
63
  },
64
64
  "peerDependencies": {
65
- "@tsed/common": "^6.100.3",
66
- "@tsed/core": "^6.100.3",
67
- "@tsed/di": "^6.100.3",
68
- "@tsed/json-mapper": "^6.100.3",
65
+ "@tsed/common": "^6.102.2",
66
+ "@tsed/core": "^6.102.2",
67
+ "@tsed/di": "^6.102.2",
68
+ "@tsed/json-mapper": "^6.102.2",
69
69
  "@tsed/logger": ">=6.0.0",
70
- "@tsed/openspec": "^6.100.3",
71
- "@tsed/schema": "^6.100.3",
70
+ "@tsed/openspec": "^6.102.2",
71
+ "@tsed/schema": "^6.102.2",
72
72
  "aws-lambda": ">=1.0.7",
73
73
  "serverless-http": ">=2.0.0"
74
74
  }
package/readme.md CHANGED
@@ -94,9 +94,7 @@ import {TimeslotsController} from "./controllers/TimeslotsController";
94
94
  @Configuration({
95
95
  acceptMimes: ["application/json"],
96
96
  mount: {
97
- "/": [
98
- TimeslotsController
99
- ]
97
+ "/": [TimeslotsController]
100
98
  },
101
99
  swagger: [
102
100
  {
@@ -110,9 +108,7 @@ import {TimeslotsController} from "./controllers/TimeslotsController";
110
108
  ejs: "ejs"
111
109
  }
112
110
  },
113
- exclude: [
114
- "**/*.spec.ts"
115
- ]
111
+ exclude: ["**/*.spec.ts"]
116
112
  })
117
113
  export class Server {
118
114
  $beforeRoutesInit(): void {
@@ -122,9 +118,11 @@ export class Server {
122
118
  .use(compress({}))
123
119
  .use(methodOverride())
124
120
  .use(bodyParser.json())
125
- .use(bodyParser.urlencoded({
126
- extended: true
127
- }));
121
+ .use(
122
+ bodyParser.urlencoded({
123
+ extended: true
124
+ })
125
+ );
128
126
  }
129
127
  }
130
128
  ```
@@ -138,7 +136,7 @@ import {Server} from "./Server";
138
136
 
139
137
  const platform = PlatformServerless.bootstrap(Server, {
140
138
  adapter: PlatformExpress
141
- })
139
+ });
142
140
 
143
141
  export const handler = platform.handler();
144
142
  ```
@@ -169,12 +167,12 @@ Finally, create the `serverless.yml`:
169
167
  ```yml
170
168
  service: timeslots
171
169
 
172
- frameworkVersion: '2'
170
+ frameworkVersion: "2"
173
171
 
174
172
  provider:
175
173
  name: aws
176
174
  runtime: nodejs14.x
177
- lambdaHashingVersion: '20201221'
175
+ lambdaHashingVersion: "20201221"
178
176
 
179
177
  plugins:
180
178
  - serverless-offline
@@ -188,7 +186,7 @@ functions:
188
186
  path: /
189
187
  - http:
190
188
  method: ANY
191
- path: '{proxy+}'
189
+ path: "{proxy+}"
192
190
  ```
193
191
 
194
192
  ## Invoke a lambda with serverless
@@ -237,22 +235,21 @@ You should see in the terminal the following result:
237
235
  This package includes decorators to easily get the event object Lambda received from API Gateway:
238
236
 
239
237
  ```typescript
240
- import {Controller, Get} from "@tsed/common";
241
- import {ServerlessEvent, ServerlessContext} from "@tsed/platform-serverless-http";
238
+ import {Controller, Get} from "@tsed/common";
239
+ import {ServerlessEvent, ServerlessContext} from "@tsed/platform-serverless-http";
242
240
 
243
241
  @Controller("/")
244
242
  class MyCtrl {
245
- @Get("/")
246
- get(@ServerlessEvent() event: any, @ServerlessContext() context: ServerlessContext) {
247
- console.log("Event", event);
248
- console.log("Context", context);
249
-
250
- return { event, context };
251
- }
243
+ @Get("/")
244
+ get(@ServerlessEvent() event: any, @ServerlessContext() context: ServerlessContext) {
245
+ console.log("Event", event);
246
+ console.log("Context", context);
247
+
248
+ return {event, context};
249
+ }
252
250
  }
253
251
  ```
254
252
 
255
-
256
253
  ## Testing
257
254
 
258
255
  Ts.ED provide a way to test you lambda with mocked Aws event and context by using the @@PlatformServerlessTest@@ util.
@@ -293,7 +290,6 @@ describe("TimeslotsController", () => {
293
290
  });
294
291
  ```
295
292
 
296
-
297
293
  ## Contributors
298
294
 
299
295
  Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html)
@@ -8,16 +8,5 @@
8
8
  "declaration": true,
9
9
  "declarationDir": "./lib/types"
10
10
  },
11
- "exclude": [
12
- "node_modules",
13
- "test",
14
- "lib",
15
- "benchmark",
16
- "coverage",
17
- "spec",
18
- "**/*.benchmark.ts",
19
- "**/*.spec.ts",
20
- "keys",
21
- "jest.config.js"
22
- ]
11
+ "exclude": ["node_modules", "test", "lib", "benchmark", "coverage", "spec", "**/*.benchmark.ts", "**/*.spec.ts", "keys", "jest.config.js"]
23
12
  }