Weird Scripts for Specific Uses
- serverless-offline
- serverless-dotenv-plugin
- serverless-webpack
- Node 18.0.0
- Yarn 1.22.19
# Install dependencies
yarn install
# Run Locally
yarn startIn order to deploy the example, you need to run the following command:
$ yarn deploy
After running deploy, you should see output similar to:
Deploying aws-node-project to stage dev (us-east-1)
✔ Service deployed to stack aws-node-project-dev (112s)
functions:
hello: aws-node-project-dev-hello (1.5 kB)After successful deployment, you can invoke the deployed function by using the following command:
serverless invoke --function SyncWhich should result in response similar to the following:
{
"statusCode": 200,
"body": "{\n\"message\": \"Ok\"\n}"
}You can invoke your function locally by using the following command:
NODE_ENV=dev FUNCTIONSFILE=local serverless invoke local --function HealthCheckWhich should result in response similar to the following:
{
"statusCode": 200,
"body": "{\n\"message\": \"Ok\"\n}"
}