MCPcopy Create free account
hub / github.com/awsrun/aws-microservices / createOrderingFunction

Method createOrderingFunction

lib/microservice.ts:81–103  ·  view source on GitHub ↗
(orderTable: ITable)

Source from the content-addressed store, hash-verified

79 }
80
81 private createOrderingFunction(orderTable: ITable) : NodejsFunction {
82 const nodeJsFunctionProps: NodejsFunctionProps = {
83 bundling: {
84 externalModules: [
85 'aws-sdk', // Use the 'aws-sdk' available in the Lambda runtime
86 ],
87 },
88 environment: {
89 PRIMARY_KEY: 'userName',
90 SORT_KEY: 'orderDate',
91 DYNAMODB_TABLE_NAME: orderTable.tableName,
92 },
93 runtime: Runtime.NODEJS_14_X,
94 }
95
96 const orderFunction = new NodejsFunction(this, 'orderingLambdaFunction', {
97 entry: join(__dirname, `/../src/ordering/index.js`),
98 ...nodeJsFunctionProps,
99 });
100
101 orderTable.grantReadWriteData(orderFunction);
102 return orderFunction;
103 }
104
105}

Callers 1

constructorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected