@tsed/platform-serverless-http 7.0.0-beta.1 → 7.0.0-beta.12
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/lib/cjs/builder/PlatformServerlessHttp.js +1 -1
- package/lib/cjs/builder/PlatformServerlessHttp.js.map +1 -1
- package/lib/cjs/constants/{index.js → constants.js} +1 -1
- package/lib/cjs/constants/constants.js.map +1 -0
- package/lib/cjs/index.js +7 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/esm/builder/PlatformServerlessHttp.js.map +1 -1
- package/lib/esm/constants/{index.js → constants.js} +1 -1
- package/lib/esm/constants/constants.js.map +1 -0
- package/lib/esm/index.js +7 -3
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/types/builder/PlatformServerlessHttp.d.ts +1 -1
- package/lib/types/constants/{index.d.ts → constants.d.ts} +0 -0
- package/lib/types/index.d.ts +4 -0
- package/package.json +43 -15
- package/readme.md +21 -38
- package/tsconfig.compile.esm.json +1 -12
- package/lib/cjs/constants/index.js.map +0 -1
- package/lib/esm/constants/index.js.map +0 -1
|
@@ -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 =
|
|
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,
|
|
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"]}
|
|
@@ -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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;
|
|
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"]}
|
|
@@ -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,
|
|
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=
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
package/lib/esm/index.js.map
CHANGED
|
@@ -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":["
|
|
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"]}
|
|
@@ -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
|
}
|
|
File without changes
|
package/lib/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-serverless-http",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.12",
|
|
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,54 @@
|
|
|
48
50
|
"bugs": {
|
|
49
51
|
"url": "https://github.com/tsedio/tsed/issues"
|
|
50
52
|
},
|
|
51
|
-
"homepage": "https://github.com/tsedio/tsed/tree/
|
|
53
|
+
"homepage": "https://github.com/tsedio/tsed/tree/beta/packages/platform/platform-serverless-http",
|
|
52
54
|
"repository": "https://github.com/tsedio/tsed",
|
|
53
55
|
"dependencies": {
|
|
54
|
-
"tslib": "2.
|
|
56
|
+
"tslib": "2.3.1"
|
|
55
57
|
},
|
|
56
58
|
"devDependencies": {
|
|
57
|
-
"@tsed/common": "7.0.0-beta.
|
|
58
|
-
"@tsed/core": "7.0.0-beta.
|
|
59
|
-
"@tsed/di": "7.0.0-beta.
|
|
60
|
-
"@tsed/platform-serverless-testing": "7.0.0-beta.
|
|
59
|
+
"@tsed/common": "7.0.0-beta.12",
|
|
60
|
+
"@tsed/core": "7.0.0-beta.12",
|
|
61
|
+
"@tsed/di": "7.0.0-beta.12",
|
|
62
|
+
"@tsed/platform-serverless-testing": "7.0.0-beta.12",
|
|
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.
|
|
66
|
-
"@tsed/core": "^7.0.0-beta.
|
|
67
|
-
"@tsed/di": "^7.0.0-beta.
|
|
68
|
-
"@tsed/json-mapper": "^7.0.0-beta.
|
|
69
|
-
"@tsed/logger": ">=6.
|
|
70
|
-
"@tsed/openspec": "^7.0.0-beta.
|
|
71
|
-
"@tsed/schema": "^7.0.0-beta.
|
|
67
|
+
"@tsed/common": "^7.0.0-beta.12",
|
|
68
|
+
"@tsed/core": "^7.0.0-beta.12",
|
|
69
|
+
"@tsed/di": "^7.0.0-beta.12",
|
|
70
|
+
"@tsed/json-mapper": "^7.0.0-beta.12",
|
|
71
|
+
"@tsed/logger": ">=6.1.1",
|
|
72
|
+
"@tsed/openspec": "^7.0.0-beta.12",
|
|
73
|
+
"@tsed/schema": "^7.0.0-beta.12",
|
|
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
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"publishConfig": {
|
|
101
|
+
"tag": "beta"
|
|
74
102
|
}
|
|
75
103
|
}
|
package/readme.md
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
[](https://badge.fury.io/js/%40tsed%2Fcommon)
|
|
12
12
|
[](https://github.com/semantic-release/semantic-release)
|
|
13
13
|
[](https://github.com/prettier/prettier)
|
|
14
|
-
[](https://github.com/sponsors/romakita)
|
|
15
|
+
[](https://opencollective.com/tsed)
|
|
15
16
|
|
|
16
17
|
</div>
|
|
17
18
|
|
|
@@ -82,11 +83,10 @@ Create new `Server.ts` to configure your Ts.ED application:
|
|
|
82
83
|
```typescript
|
|
83
84
|
import {Configuration, Inject} from "@tsed/di";
|
|
84
85
|
import {PlatformApplication} from "@tsed/common";
|
|
85
|
-
import
|
|
86
|
+
import cors from "cors";
|
|
86
87
|
import compress from "compression";
|
|
87
88
|
import cookieParser from "cookie-parser";
|
|
88
89
|
import methodOverride from "method-override";
|
|
89
|
-
import cors from "cors";
|
|
90
90
|
import "@tsed/ajv";
|
|
91
91
|
import "@tsed/swagger";
|
|
92
92
|
import {TimeslotsController} from "./controllers/TimeslotsController";
|
|
@@ -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
|
{
|
|
@@ -105,28 +103,15 @@ import {TimeslotsController} from "./controllers/TimeslotsController";
|
|
|
105
103
|
}
|
|
106
104
|
],
|
|
107
105
|
views: {
|
|
108
|
-
root:
|
|
106
|
+
root: "${rootDir}/views",
|
|
109
107
|
extensions: {
|
|
110
108
|
ejs: "ejs"
|
|
111
109
|
}
|
|
112
110
|
},
|
|
113
|
-
exclude: [
|
|
114
|
-
|
|
115
|
-
]
|
|
111
|
+
exclude: ["**/*.spec.ts"],
|
|
112
|
+
middlewares: [cors(), compress({}), cookieParser(), methodOverride()]
|
|
116
113
|
})
|
|
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
|
-
}
|
|
114
|
+
export class Server {}
|
|
130
115
|
```
|
|
131
116
|
|
|
132
117
|
Create new `handler.ts` to expose your lambda:
|
|
@@ -138,7 +123,7 @@ import {Server} from "./Server";
|
|
|
138
123
|
|
|
139
124
|
const platform = PlatformServerless.bootstrap(Server, {
|
|
140
125
|
adapter: PlatformExpress
|
|
141
|
-
})
|
|
126
|
+
});
|
|
142
127
|
|
|
143
128
|
export const handler = platform.handler();
|
|
144
129
|
```
|
|
@@ -169,12 +154,12 @@ Finally, create the `serverless.yml`:
|
|
|
169
154
|
```yml
|
|
170
155
|
service: timeslots
|
|
171
156
|
|
|
172
|
-
frameworkVersion:
|
|
157
|
+
frameworkVersion: "2"
|
|
173
158
|
|
|
174
159
|
provider:
|
|
175
160
|
name: aws
|
|
176
161
|
runtime: nodejs14.x
|
|
177
|
-
lambdaHashingVersion:
|
|
162
|
+
lambdaHashingVersion: "20201221"
|
|
178
163
|
|
|
179
164
|
plugins:
|
|
180
165
|
- serverless-offline
|
|
@@ -188,7 +173,7 @@ functions:
|
|
|
188
173
|
path: /
|
|
189
174
|
- http:
|
|
190
175
|
method: ANY
|
|
191
|
-
path:
|
|
176
|
+
path: "{proxy+}"
|
|
192
177
|
```
|
|
193
178
|
|
|
194
179
|
## Invoke a lambda with serverless
|
|
@@ -237,22 +222,21 @@ You should see in the terminal the following result:
|
|
|
237
222
|
This package includes decorators to easily get the event object Lambda received from API Gateway:
|
|
238
223
|
|
|
239
224
|
```typescript
|
|
240
|
-
import {Controller, Get} from "@tsed/common";
|
|
241
|
-
import {ServerlessEvent, ServerlessContext} from "@tsed/platform-serverless-http";
|
|
225
|
+
import {Controller, Get} from "@tsed/common";
|
|
226
|
+
import {ServerlessEvent, ServerlessContext} from "@tsed/platform-serverless-http";
|
|
242
227
|
|
|
243
228
|
@Controller("/")
|
|
244
229
|
class MyCtrl {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
230
|
+
@Get("/")
|
|
231
|
+
get(@ServerlessEvent() event: any, @ServerlessContext() context: ServerlessContext) {
|
|
232
|
+
console.log("Event", event);
|
|
233
|
+
console.log("Context", context);
|
|
234
|
+
|
|
235
|
+
return {event, context};
|
|
236
|
+
}
|
|
252
237
|
}
|
|
253
238
|
```
|
|
254
239
|
|
|
255
|
-
|
|
256
240
|
## Testing
|
|
257
241
|
|
|
258
242
|
Ts.ED provide a way to test you lambda with mocked Aws event and context by using the @@PlatformServerlessTest@@ util.
|
|
@@ -293,7 +277,6 @@ describe("TimeslotsController", () => {
|
|
|
293
277
|
});
|
|
294
278
|
```
|
|
295
279
|
|
|
296
|
-
|
|
297
280
|
## Contributors
|
|
298
281
|
|
|
299
282
|
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"]}
|