Skip to content

Instantly share code, notes, and snippets.

@louislatreille
Created April 10, 2022 22:23
Show Gist options
  • Save louislatreille/86c375ae2758706b0cc56533b3408627 to your computer and use it in GitHub Desktop.
Save louislatreille/86c375ae2758706b0cc56533b3408627 to your computer and use it in GitHub Desktop.
Serverless Streamlined - postMessage
import { createFunctionHandler } from "@resources/createFunctionHandler";
import { AwsCfInstruction } from "@serverless/typescript";
export const postMessage = (mainTableArn: AwsCfInstruction, mainTableName: AwsCfInstruction) =>
createFunctionHandler(
"postMessage",
"/messages",
"POST",
undefined,
[
{
Action: ["dynamodb:UpdateItem"],
Resource: [mainTableArn],
Effect: "Allow",
},
],
{
MAIN_TABLE_NAME: mainTableName,
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment