Closed tunesmith closed 2 years ago
I just discovered the "easy way":
template.yaml:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: hello-world/
Handler: server.default # default export
server.ts:
// as described in README
export default startServerAndCreateLambdaHandler(server);
Since the recommended approach is to export a call to a function, this doesn't play nicely with the idiomatic SAM approach. Where SAM template.yaml might have:
This in server.ts:
yields a
This approach appears to work:
While this one does not:
(same error as above)
(The above yields a
)
Meanwhile, the following does work:
Although I'm not sure what to do with the callback parameter.
Is there a simpler way to enable this? For SAM purposes, ideally we should be able to export something named we can refer to in the template.yaml (that isn't the output of a function).