-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.ts
45 lines (42 loc) · 1.3 KB
/
serverless.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import type { AWS } from "@serverless/typescript";
import * as commandHandlers from "./src/commands";
import * as eventHandlers from "./src/events";
import * as queryHandlers from "./src/querys";
import { EventStoreTable } from "./resources/eventStore";
import { ProjectionTable } from "./resources/dynamodbProjection";
import { DomainEventBus } from "./resources/eventBridge";
import EventStream from "./src/infra/eventStream";
const serverlessConfiguration: AWS = {
service: "cqrs-template",
frameworkVersion: "2",
plugins: ["serverless-esbuild", "serverless-iam-roles-per-function"],
package: {
individually: true,
patterns: ["!./**"],
},
custom: {
eventBusArn: 'arn:aws:events:${AWS::Region}:${AWS::AccountId}:event-bus/domain-events'
},
provider: {
name: "aws",
runtime: "nodejs14.x",
apiGateway: {
minimumCompressionSize: 1024,
shouldStartNameWithService: true,
},
environment: {
AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1",
},
lambdaHashingVersion: "20201221",
eventBridge: { useCloudFormation: true },
},
functions: { ...commandHandlers, ...eventHandlers, ...queryHandlers, EventStream },
resources: {
Resources: {
EventStoreTable,
ProjectionTable,
DomainEventBus,
},
},
};
module.exports = serverlessConfiguration;