You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs/{{cookiecutter.project_name}}/README.md
+15-8Lines changed: 15 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ This is a sample template for {{ cookiecutter.project_name }} - Below is a brief
5
5
```bash
6
6
.
7
7
├── README.md <-- This instructions file
8
-
├── hello_world<-- Source code for a lambda function
8
+
├── hello-world<-- Source code for a lambda function
9
9
│ ├── app.js <-- Lambda functioncode
10
10
│ ├── package.json <-- NodeJS dependencies
11
11
│ └── tests <-- Unit tests
@@ -28,15 +28,21 @@ This is a sample template for {{ cookiecutter.project_name }} - Below is a brief
28
28
29
29
## Setup process
30
30
31
-
### Installing dependencies
31
+
### Building the project
32
32
33
-
In this example we use `npm` but you can use `yarn` if you prefer to manage NodeJS dependencies:
33
+
[AWS Lambda requires a flat folder](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-create-deployment-pkg.html) with the application as well as its dependencies in a node_modules folder. When you make changes to your source code or dependency manifest,
34
+
run the following command to build your project local testing and deployment:
35
+
36
+
```bash
37
+
sam build
38
+
```
34
39
40
+
If your dependencies contain native modules that need to be compiled specifically for the operating system running on AWS Lambda, use this command to build inside a Lambda-like Docker container instead:
35
41
```bash
36
-
cd hello_world
37
-
npm install
38
-
cd ../
42
+
sam build --use-container
39
43
```
44
+
45
+
By default, this command writes built artifacts to `.aws-sam/build` folder.
40
46
41
47
### Local development
42
48
@@ -69,7 +75,7 @@ AWS Lambda NodeJS runtime requires a flat folder with all dependencies including
We use `mocha` for testing our code and it is already added in `package.json` under `scripts`, so that we can simply run the following command to run our tests:
Copy file name to clipboardExpand all lines: samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs/{{cookiecutter.project_name}}/template.yaml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Resources:
16
16
HelloWorldFunction:
17
17
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
0 commit comments