amazon-archives / awsmobile-cli

CLI experience for Frontend developers in the JavaScript ecosystem.
Apache License 2.0
142 stars 35 forks source link

A sample lambda is created when enabling cloud-api #184

Open jarrettj opened 5 years ago

jarrettj commented 5 years ago

Hi,

Good day.

Why is a sampleCloudApi function created? Can it be renamed? And if it is removed it still stays in the folder.

$ awsmobile cloud-api enable

Adding lambda function code on 
/Users/thejj/work/angular/projects/testing/awsmobilejs/backend/cloud-api/sampleLambda/
...

To test the api from the command line (after awsmobile push) use this commands
awsmobile cloud-api invoke sampleCloudApi <method> /items [init]

Regards.

elorzafe commented 5 years ago

Hi,

When you enable cloud-api on your project like you did. awsmobile-cli creates a sample function so you can test your api against that function. Is an starting point to create your own functions on serverless express.

awsmobile-cli is not removing the folder in purpose so wont lose your code accidentally.

If you run awsmobile cloud-api enable -p (if you dont have that feature enabled) or awsmobile cloud-api configure (in case you have and select create new api) you can configure the function name that will create a directory with the same name.