aws / chalice

Python Serverless Microframework for AWS
Apache License 2.0
10.67k stars 1.01k forks source link

possible to write pure function in javascript inside chalice? #1948

Open dragonballa opened 2 years ago

dragonballa commented 2 years ago

i want to create a pure function but the actual code is already in javascript that I want to deploy via chalice

is this possible? how can i pull something like this off, maybe store my javascript somewhere and have chalice upload?

also is it possible to apply @app.routes to this pure lambda function?


@app.lambda_function()
def custom_lambda_function(event, context):
    console.log(''); 
    var hello = "hello world";
    return hello
skwashd commented 2 years ago

This won't work as you documented here.

You can do is use the Cloudformation support in chalice deploy to add an extra endpoint to the API Gateway. Have that reference reference your node Lambda that you package using Cloudformation. Checkout the documentation at https://aws.github.io/chalice/topics/cfn.html for more info on the Cloudformation support in chalice.