@tsed/platform-serverless-http 7.0.0-beta.1 → 7.0.0-beta.4

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.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PlatformServerlessHttp = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const common_1 = require("@tsed/common");
6
- const serverless_http_1 = (0, tslib_1.__importDefault)(require("serverless-http"));
6
+ const serverless_http_1 = tslib_1.__importDefault(require("serverless-http"));
7
7
  class PlatformServerlessHttp {
8
8
  static bootstrap(module, settings) {
9
9
  const platform = common_1.PlatformBuilder.create(module, settings);
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformServerlessHttp.js","sourceRoot":"","sources":["../../../src/builder/PlatformServerlessHttp.ts"],"names":[],"mappings":";;;;AAAA,yCAAsE;AAGtE,mFAAyC;AAEzC,MAAa,sBAAsB;IACjC,MAAM,CAAC,SAAS,CAAC,MAAiB,EAAE,QAAiC;QACnE,MAAM,QAAQ,GAAG,wBAAe,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAEjC,QAAgB,CAAC,OAAO,GAAG,GAAY,EAAE;YACxC,IAAI,OAAY,CAAC;YAEjB,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC9B,uBAAuB;gBACvB,IAAI,CAAC,OAAO,EAAE;oBACZ,MAAM,OAAO,CAAC;oBACd,OAAO,GAAG,IAAA,yBAAU,EAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE;wBACxC,OAAO,CAAC,OAAY;4BAClB,OAAO,CAAC,UAAU,GAAG,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC;wBACxC,CAAC;qBACF,CAAC,CAAC;iBACJ;gBAED,OAAO,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACjC,CAAC,CAAC;QACJ,CAAC,CAAC;QAEF,OAAO,QAAe,CAAC;IACzB,CAAC;CACF;AAzBD,wDAyBC","sourcesContent":["import {PlatformBuilder, PlatformBuilderSettings} from \"@tsed/common\";\nimport {Type} from \"@tsed/core\";\nimport type {Handler} from \"aws-lambda\";\nimport serverless from \"serverless-http\";\n\nexport class PlatformServerlessHttp {\n static bootstrap(module: Type<any>, settings: PlatformBuilderSettings): PlatformBuilder & {handler(): Handler} {\n const platform = PlatformBuilder.create(module, settings);\n const promise = platform.listen();\n\n (platform as any).handler = (): Handler => {\n let handler: any;\n\n return async (event, context) => {\n // istanbul ignore else\n if (!handler) {\n await promise;\n handler = serverless(platform.callback(), {\n request(request: any) {\n request.serverless = {event, context};\n }\n });\n }\n\n return handler(event, context);\n };\n };\n\n return platform as any;\n }\n}\n"]}
1
+ {"version":3,"file":"PlatformServerlessHttp.js","sourceRoot":"","sources":["../../../src/builder/PlatformServerlessHttp.ts"],"names":[],"mappings":";;;;AAAA,yCAAsE;AAGtE,8EAAyC;AAEzC,MAAa,sBAAsB;IACjC,MAAM,CAAC,SAAS,CAAC,MAAiB,EAAE,QAA2C;QAC7E,MAAM,QAAQ,GAAG,wBAAe,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAEjC,QAAgB,CAAC,OAAO,GAAG,GAAY,EAAE;YACxC,IAAI,OAAY,CAAC;YAEjB,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC9B,uBAAuB;gBACvB,IAAI,CAAC,OAAO,EAAE;oBACZ,MAAM,OAAO,CAAC;oBACd,OAAO,GAAG,IAAA,yBAAU,EAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE;wBACxC,OAAO,CAAC,OAAY;4BAClB,OAAO,CAAC,UAAU,GAAG,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC;wBACxC,CAAC;qBACF,CAAC,CAAC;iBACJ;gBAED,OAAO,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACjC,CAAC,CAAC;QACJ,CAAC,CAAC;QAEF,OAAO,QAAe,CAAC;IACzB,CAAC;CACF;AAzBD,wDAyBC","sourcesContent":["import {PlatformBuilder, PlatformBuilderSettings} from \"@tsed/common\";\nimport {Type} from \"@tsed/core\";\nimport type {Handler} from \"aws-lambda\";\nimport serverless from \"serverless-http\";\n\nexport class PlatformServerlessHttp {\n static bootstrap(module: Type<any>, settings: PlatformBuilderSettings<any, any>): PlatformBuilder & {handler(): Handler} {\n const platform = PlatformBuilder.create(module, settings);\n const promise = platform.listen();\n\n (platform as any).handler = (): Handler => {\n let handler: any;\n\n return async (event, context) => {\n // istanbul ignore else\n if (!handler) {\n await promise;\n handler = serverless(platform.callback(), {\n request(request: any) {\n request.serverless = {event, context};\n }\n });\n }\n\n return handler(event, context);\n };\n };\n\n return platform as any;\n }\n}\n"]}
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AWS_API_GATEWAY = void 0;
4
4
  exports.AWS_API_GATEWAY = "AWS_API_GATEWAY";
5
- //# sourceMappingURL=index.js.map
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,iBAAiB,CAAC","sourcesContent":["export const AWS_API_GATEWAY = \"AWS_API_GATEWAY\";\n"]}
package/lib/cjs/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ /**
3
+ * @file Automatically generated by barrelsby.
4
+ */
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./builder/PlatformServerlessHttp"), exports);
5
- (0, tslib_1.__exportStar)(require("./decorators/serverlessContext"), exports);
6
- (0, tslib_1.__exportStar)(require("./decorators/serverlessEvent"), exports);
7
+ tslib_1.__exportStar(require("./builder/PlatformServerlessHttp"), exports);
8
+ tslib_1.__exportStar(require("./constants/constants"), exports);
9
+ tslib_1.__exportStar(require("./decorators/serverlessContext"), exports);
10
+ tslib_1.__exportStar(require("./decorators/serverlessEvent"), exports);
7
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,gFAAiD;AACjD,8EAA+C;AAC/C,4EAA6C","sourcesContent":["export * from \"./builder/PlatformServerlessHttp\";\nexport * from \"./decorators/serverlessContext\";\nexport * from \"./decorators/serverlessEvent\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,2EAAiD;AACjD,gEAAsC;AACtC,yEAA+C;AAC/C,uEAA6C","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./builder/PlatformServerlessHttp\";\nexport * from \"./constants/constants\";\nexport * from \"./decorators/serverlessContext\";\nexport * from \"./decorators/serverlessEvent\";\n"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformServerlessHttp.js","sourceRoot":"","sources":["../../../src/builder/PlatformServerlessHttp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAA0B,MAAM,cAAc,CAAC;AAGtE,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,OAAO,sBAAsB;IACjC,MAAM,CAAC,SAAS,CAAC,MAAiB,EAAE,QAAiC;QACnE,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAEjC,QAAgB,CAAC,OAAO,GAAG,GAAY,EAAE;YACxC,IAAI,OAAY,CAAC;YAEjB,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC9B,uBAAuB;gBACvB,IAAI,CAAC,OAAO,EAAE;oBACZ,MAAM,OAAO,CAAC;oBACd,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE;wBACxC,OAAO,CAAC,OAAY;4BAClB,OAAO,CAAC,UAAU,GAAG,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC;wBACxC,CAAC;qBACF,CAAC,CAAC;iBACJ;gBAED,OAAO,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACjC,CAAC,CAAC;QACJ,CAAC,CAAC;QAEF,OAAO,QAAe,CAAC;IACzB,CAAC;CACF","sourcesContent":["import {PlatformBuilder, PlatformBuilderSettings} from \"@tsed/common\";\nimport {Type} from \"@tsed/core\";\nimport type {Handler} from \"aws-lambda\";\nimport serverless from \"serverless-http\";\n\nexport class PlatformServerlessHttp {\n static bootstrap(module: Type<any>, settings: PlatformBuilderSettings): PlatformBuilder & {handler(): Handler} {\n const platform = PlatformBuilder.create(module, settings);\n const promise = platform.listen();\n\n (platform as any).handler = (): Handler => {\n let handler: any;\n\n return async (event, context) => {\n // istanbul ignore else\n if (!handler) {\n await promise;\n handler = serverless(platform.callback(), {\n request(request: any) {\n request.serverless = {event, context};\n }\n });\n }\n\n return handler(event, context);\n };\n };\n\n return platform as any;\n }\n}\n"]}
1
+ {"version":3,"file":"PlatformServerlessHttp.js","sourceRoot":"","sources":["../../../src/builder/PlatformServerlessHttp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAA0B,MAAM,cAAc,CAAC;AAGtE,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,OAAO,sBAAsB;IACjC,MAAM,CAAC,SAAS,CAAC,MAAiB,EAAE,QAA2C;QAC7E,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAEjC,QAAgB,CAAC,OAAO,GAAG,GAAY,EAAE;YACxC,IAAI,OAAY,CAAC;YAEjB,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC9B,uBAAuB;gBACvB,IAAI,CAAC,OAAO,EAAE;oBACZ,MAAM,OAAO,CAAC;oBACd,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE;wBACxC,OAAO,CAAC,OAAY;4BAClB,OAAO,CAAC,UAAU,GAAG,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC;wBACxC,CAAC;qBACF,CAAC,CAAC;iBACJ;gBAED,OAAO,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACjC,CAAC,CAAC;QACJ,CAAC,CAAC;QAEF,OAAO,QAAe,CAAC;IACzB,CAAC;CACF","sourcesContent":["import {PlatformBuilder, PlatformBuilderSettings} from \"@tsed/common\";\nimport {Type} from \"@tsed/core\";\nimport type {Handler} from \"aws-lambda\";\nimport serverless from \"serverless-http\";\n\nexport class PlatformServerlessHttp {\n static bootstrap(module: Type<any>, settings: PlatformBuilderSettings<any, any>): PlatformBuilder & {handler(): Handler} {\n const platform = PlatformBuilder.create(module, settings);\n const promise = platform.listen();\n\n (platform as any).handler = (): Handler => {\n let handler: any;\n\n return async (event, context) => {\n // istanbul ignore else\n if (!handler) {\n await promise;\n handler = serverless(platform.callback(), {\n request(request: any) {\n request.serverless = {event, context};\n }\n });\n }\n\n return handler(event, context);\n };\n };\n\n return platform as any;\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
1
  export const AWS_API_GATEWAY = "AWS_API_GATEWAY";
2
- //# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC","sourcesContent":["export const AWS_API_GATEWAY = \"AWS_API_GATEWAY\";\n"]}
package/lib/esm/index.js CHANGED
@@ -1,4 +1,8 @@
1
- export * from "./builder/PlatformServerlessHttp";
2
- export * from "./decorators/serverlessContext";
3
- export * from "./decorators/serverlessEvent";
1
+ /**
2
+ * @file Automatically generated by barrelsby.
3
+ */
4
+ export * from "./builder/PlatformServerlessHttp.js";
5
+ export * from "./constants/constants.js";
6
+ export * from "./decorators/serverlessContext.js";
7
+ export * from "./decorators/serverlessEvent.js";
4
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC","sourcesContent":["export * from \"./builder/PlatformServerlessHttp\";\nexport * from \"./decorators/serverlessContext\";\nexport * from \"./decorators/serverlessEvent\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./builder/PlatformServerlessHttp\";\nexport * from \"./constants/constants\";\nexport * from \"./decorators/serverlessContext\";\nexport * from \"./decorators/serverlessEvent\";\n"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -2,7 +2,7 @@ import { PlatformBuilder, PlatformBuilderSettings } from "@tsed/common";
2
2
  import { Type } from "@tsed/core";
3
3
  import type { Handler } from "aws-lambda";
4
4
  export declare class PlatformServerlessHttp {
5
- static bootstrap(module: Type<any>, settings: PlatformBuilderSettings): PlatformBuilder & {
5
+ static bootstrap(module: Type<any>, settings: PlatformBuilderSettings<any, any>): PlatformBuilder & {
6
6
  handler(): Handler;
7
7
  };
8
8
  }
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @file Automatically generated by barrelsby.
3
+ */
1
4
  export * from "./builder/PlatformServerlessHttp";
5
+ export * from "./constants/constants";
2
6
  export * from "./decorators/serverlessContext";
3
7
  export * from "./decorators/serverlessEvent";
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@tsed/platform-serverless-http",
3
- "version": "7.0.0-beta.1",
3
+ "version": "7.0.0-beta.4",
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",
7
+ "module": "./lib/esm/index.js",
7
8
  "typings": "./lib/types/index.d.ts",
8
9
  "exports": {
9
10
  "types": "./lib/types/index.d.ts",
@@ -12,9 +13,10 @@
12
13
  "default": "./lib/esm/index.js"
13
14
  },
14
15
  "scripts": {
15
- "build": "yarn run build:esm && yarn run build:cjs",
16
+ "build": "yarn barrels && yarn run build:esm && yarn run build:cjs",
16
17
  "build:cjs": "tsc --build tsconfig.compile.json",
17
18
  "build:esm": "tsc --build tsconfig.compile.esm.json",
19
+ "barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\"",
18
20
  "test": "cross-env NODE_ENV=test jest"
19
21
  },
20
22
  "private": false,
@@ -48,28 +50,51 @@
48
50
  "bugs": {
49
51
  "url": "https://github.com/tsedio/tsed/issues"
50
52
  },
51
- "homepage": "https://github.com/tsedio/tsed/tree/alpha/packages/platform/platform-serverless-http",
53
+ "homepage": "https://github.com/tsedio/tsed/tree/production/packages/platform/platform-serverless-http",
52
54
  "repository": "https://github.com/tsedio/tsed",
53
55
  "dependencies": {
54
- "tslib": "2.2.0"
56
+ "tslib": "2.3.1"
55
57
  },
56
58
  "devDependencies": {
57
- "@tsed/common": "7.0.0-beta.1",
58
- "@tsed/core": "7.0.0-beta.1",
59
- "@tsed/di": "7.0.0-beta.1",
60
- "@tsed/platform-serverless-testing": "7.0.0-beta.1",
59
+ "@tsed/common": "7.0.0-beta.4",
60
+ "@tsed/core": "7.0.0-beta.4",
61
+ "@tsed/di": "7.0.0-beta.4",
62
+ "@tsed/platform-serverless-testing": "7.0.0-beta.4",
61
63
  "aws-lambda": "^1.0.7",
62
64
  "serverless-http": "^2.7.0"
63
65
  },
64
66
  "peerDependencies": {
65
- "@tsed/common": "^7.0.0-beta.1",
66
- "@tsed/core": "^7.0.0-beta.1",
67
- "@tsed/di": "^7.0.0-beta.1",
68
- "@tsed/json-mapper": "^7.0.0-beta.1",
69
- "@tsed/logger": ">=6.0.0",
70
- "@tsed/openspec": "^7.0.0-beta.1",
71
- "@tsed/schema": "^7.0.0-beta.1",
67
+ "@tsed/common": "^7.0.0-beta.4",
68
+ "@tsed/core": "^7.0.0-beta.4",
69
+ "@tsed/di": "^7.0.0-beta.4",
70
+ "@tsed/json-mapper": "^7.0.0-beta.4",
71
+ "@tsed/logger": ">=6.1.1",
72
+ "@tsed/openspec": "^7.0.0-beta.4",
73
+ "@tsed/schema": "^7.0.0-beta.4",
72
74
  "aws-lambda": ">=1.0.7",
73
75
  "serverless-http": ">=2.0.0"
76
+ },
77
+ "peerDependenciesMeta": {
78
+ "@tsed/common": {
79
+ "optional": false
80
+ },
81
+ "@tsed/core": {
82
+ "optional": false
83
+ },
84
+ "@tsed/di": {
85
+ "optional": false
86
+ },
87
+ "@tsed/json-mapper": {
88
+ "optional": false
89
+ },
90
+ "@tsed/logger": {
91
+ "optional": false
92
+ },
93
+ "@tsed/openspec": {
94
+ "optional": false
95
+ },
96
+ "@tsed/schema": {
97
+ "optional": false
98
+ }
74
99
  }
75
100
  }
package/readme.md CHANGED
@@ -82,11 +82,10 @@ Create new `Server.ts` to configure your Ts.ED application:
82
82
  ```typescript
83
83
  import {Configuration, Inject} from "@tsed/di";
84
84
  import {PlatformApplication} from "@tsed/common";
85
- import bodyParser from "body-parser";
85
+ import cors from "cors";
86
86
  import compress from "compression";
87
87
  import cookieParser from "cookie-parser";
88
88
  import methodOverride from "method-override";
89
- import cors from "cors";
90
89
  import "@tsed/ajv";
91
90
  import "@tsed/swagger";
92
91
  import {TimeslotsController} from "./controllers/TimeslotsController";
@@ -94,9 +93,7 @@ import {TimeslotsController} from "./controllers/TimeslotsController";
94
93
  @Configuration({
95
94
  acceptMimes: ["application/json"],
96
95
  mount: {
97
- "/": [
98
- TimeslotsController
99
- ]
96
+ "/": [TimeslotsController]
100
97
  },
101
98
  swagger: [
102
99
  {
@@ -105,28 +102,15 @@ import {TimeslotsController} from "./controllers/TimeslotsController";
105
102
  }
106
103
  ],
107
104
  views: {
108
- root: `${rootDir}/views`,
105
+ root: "${rootDir}/views",
109
106
  extensions: {
110
107
  ejs: "ejs"
111
108
  }
112
109
  },
113
- exclude: [
114
- "**/*.spec.ts"
115
- ]
110
+ exclude: ["**/*.spec.ts"],
111
+ middlewares: [cors(), compress({}), cookieParser(), methodOverride()]
116
112
  })
117
- export class Server {
118
- $beforeRoutesInit(): void {
119
- this.app
120
- .use(cors())
121
- .use(cookieParser())
122
- .use(compress({}))
123
- .use(methodOverride())
124
- .use(bodyParser.json())
125
- .use(bodyParser.urlencoded({
126
- extended: true
127
- }));
128
- }
129
- }
113
+ export class Server {}
130
114
  ```
131
115
 
132
116
  Create new `handler.ts` to expose your lambda:
@@ -138,7 +122,7 @@ import {Server} from "./Server";
138
122
 
139
123
  const platform = PlatformServerless.bootstrap(Server, {
140
124
  adapter: PlatformExpress
141
- })
125
+ });
142
126
 
143
127
  export const handler = platform.handler();
144
128
  ```
@@ -169,12 +153,12 @@ Finally, create the `serverless.yml`:
169
153
  ```yml
170
154
  service: timeslots
171
155
 
172
- frameworkVersion: '2'
156
+ frameworkVersion: "2"
173
157
 
174
158
  provider:
175
159
  name: aws
176
160
  runtime: nodejs14.x
177
- lambdaHashingVersion: '20201221'
161
+ lambdaHashingVersion: "20201221"
178
162
 
179
163
  plugins:
180
164
  - serverless-offline
@@ -188,7 +172,7 @@ functions:
188
172
  path: /
189
173
  - http:
190
174
  method: ANY
191
- path: '{proxy+}'
175
+ path: "{proxy+}"
192
176
  ```
193
177
 
194
178
  ## Invoke a lambda with serverless
@@ -237,22 +221,21 @@ You should see in the terminal the following result:
237
221
  This package includes decorators to easily get the event object Lambda received from API Gateway:
238
222
 
239
223
  ```typescript
240
- import {Controller, Get} from "@tsed/common";
241
- import {ServerlessEvent, ServerlessContext} from "@tsed/platform-serverless-http";
224
+ import {Controller, Get} from "@tsed/common";
225
+ import {ServerlessEvent, ServerlessContext} from "@tsed/platform-serverless-http";
242
226
 
243
227
  @Controller("/")
244
228
  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
- }
229
+ @Get("/")
230
+ get(@ServerlessEvent() event: any, @ServerlessContext() context: ServerlessContext) {
231
+ console.log("Event", event);
232
+ console.log("Context", context);
233
+
234
+ return {event, context};
235
+ }
252
236
  }
253
237
  ```
254
238
 
255
-
256
239
  ## Testing
257
240
 
258
241
  Ts.ED provide a way to test you lambda with mocked Aws event and context by using the @@PlatformServerlessTest@@ util.
@@ -293,7 +276,6 @@ describe("TimeslotsController", () => {
293
276
  });
294
277
  ```
295
278
 
296
-
297
279
  ## Contributors
298
280
 
299
281
  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
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,iBAAiB,CAAC","sourcesContent":["export const AWS_API_GATEWAY = \"AWS_API_GATEWAY\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC","sourcesContent":["export const AWS_API_GATEWAY = \"AWS_API_GATEWAY\";\n"]}