Skip to content

Instantly share code, notes, and snippets.

@cal0610
Last active November 1, 2022 10:03
Show Gist options
  • Save cal0610/30ce283c845250b191a4b644d2f4340b to your computer and use it in GitHub Desktop.
Save cal0610/30ce283c845250b191a4b644d2f4340b to your computer and use it in GitHub Desktop.
create nodejs lambda functions
const nodejsProps: NodejsFunctionProps = {
depsLockFilePath: join(__dirname, '..', 'package-lock.json'),
environment: {
STORE_PRIMARY_KEY: 'id', // we're able to reference it in our lambda function with process.env
STORE_TABLE_NAME: storesTable.tableName,
}
};
const getOneLambda = new NodejsFunction(this, 'getOneStoreFunction', {
entry: join(__dirname, '..', 'get-one.ts'),
...nodejsProps,
});
const getAllLambda = new NodejsFunction(this, 'getAllStoresFunction', {
entry: join(__dirname, '..', 'get-all.ts'),
...nodejsProps,
});
const createOneLambda = new NodejsFunction(this, 'createStoreFunction', {
entry: join(__dirname, '..', 'create.ts'),
...nodejsProps,
});
const updateOneLambda = new NodejsFunction(this, 'updateStoreFunction', {
entry: join(__dirname, '..', 'update-one.ts'),
...nodejsProps,
});
const deleteOneLambda = new NodejsFunction(this, 'deleteStoreFunction', {
entry: join(__dirname, '..', 'delete-one.ts'),
...nodejsProps,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment