Run this command to initialize a new project in a new working directory.
npm install
In order to deploy, you need to run the following command:
$ serverless deploy
After running deploy, you should see output similar to:
Deploying expansions-team to stage dev (us-east-1)
โ Service deployed to stack expansions-team (112s)
functions:
hello: expansions-team-hello (1.5 kB)
After successful deployment, you can invoke the deployed function by using the following command:
serverless invoke --function hello
Which should result in response similar to the following:
{
"statusCode": 200,
"body": "{\n \"message\": \"Go Serverless v3.0! Your function executed successfully!\",\n \"input\": {}\n}"
}
You can also invoke the deployed function using curl:
curl https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com/
You can invoke your function locally by using the following command:
serverless invoke local --function hello
Which should result in response similar to the following:
{
"statusCode": 200,
"body": "{\n \"message\": \"Go Serverless v3.0! Your function executed successfully!\",\n \"input\": \"\"\n}"
}