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: _chapters/auth-in-serverless-apps.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ For reference, here is what we have so far.
26
26
27
27
Our users make a request to our serverless API. It starts by hitting our API Gateway endpoint. And depending on the endpoint we request, it'll forward that request to the appropriate Lambda function.
28
28
29
-
In terms of access control, our API Gateway endpoint is allowed to invoke the Lambda functions we listed in the routes of our `lib/ApiStack.js`. And if you'll recall, our Lambda function are allowed to connect to our DynamoDB tables.
29
+
In terms of access control, our API Gateway endpoint is allowed to invoke the Lambda functions we listed in the routes of our `stacks/ApiStack.js`. And if you'll recall, our Lambda function are allowed to connect to our DynamoDB tables.
Copy file name to clipboardexpand all lines: _chapters/create-a-dynamodb-table-in-sst.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ We are now going to start creating our infrastructure in [SST]({{ site.sst_githu
13
13
14
14
### Create a Stack
15
15
16
-
{%change%} Add the following to a new file in `lib/StorageStack.js`.
16
+
{%change%} Add the following to a new file in `stacks/StorageStack.js`.
17
17
18
18
```js
19
19
import*assstfrom"@serverless-stack/resources";
@@ -69,7 +69,7 @@ This'll allow us to reference this resource in our other stacks.
69
69
70
70
Now let's add this stack to our app.
71
71
72
-
{%change%} Replace the `lib/index.js` with this.
72
+
{%change%} Replace the `stacks/index.js` with this.
73
73
74
74
```js
75
75
importStorageStackfrom"./StorageStack";
@@ -92,7 +92,7 @@ Stack dev-notes-storage
92
92
Status: deployed
93
93
```
94
94
95
-
The `Stack` name above of `dev-notes-storage` is a string derived from your `${stageName}-${appName}-${stackName}`. Your `appName` is defined in the `name` field of your `sst.json` file and your `stackName` is the label you choose for your stack in `lib/index.js'.
95
+
The `Stack` name above of `dev-notes-storage` is a string derived from your `${stageName}-${appName}-${stackName}`. Your `appName` is defined in the `name` field of your `sst.json` file and your `stackName` is the label you choose for your stack in `stacks/index.js'.
96
96
97
97
### Remove Template Files
98
98
@@ -101,7 +101,7 @@ There are a couple of files that came with our starter template, that we can now
101
101
{%change%} Run the following in your project root.
102
102
103
103
```bash
104
-
$ rm lib/MyStack.js src/lambda.js
104
+
$ rm stacks/MyStack.js src/lambda.js
105
105
```
106
106
107
107
Now that our database has been created, let's create an S3 bucket to handle file uploads.
Copy file name to clipboardexpand all lines: _chapters/create-a-new-reactjs-app.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@ Now to use this package, we'll add it to our `package.json` scripts.
59
59
60
60
We are going to be deploying our React app to AWS. To do that we'll be using the SST [`ReactStaticSite`](https://docs.serverless-stack.com/constructs/ReactStaticSite) construct.
61
61
62
-
{%change%} Create a new file in `lib/FrontendStack.js` and add the following.
62
+
{%change%} Create a new file in `stacks/FrontendStack.js` and add the following.
63
63
64
64
```js
65
65
import*assstfrom"@serverless-stack/resources";
@@ -105,7 +105,7 @@ We are doing a couple of things of note here:
105
105
106
106
Let's add this new stack to the rest of our app.
107
107
108
-
{%change%} Replace the `main` function in `lib/index.js` with.
108
+
{%change%} Replace the `main` function in `stacks/index.js` with.
Copy file name to clipboardexpand all lines: _chapters/create-an-sst-app.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,9 @@ By default our app will be deployed to an environment (or stage) called `dev` in
33
33
34
34
An SST app is made up of two parts.
35
35
36
-
1.`lib/` — App Infrastructure
36
+
1.`stacks/` — App Infrastructure
37
37
38
-
The code that describes the infrastructure of your serverless app is placed in the `lib/` directory of your project. SST uses [AWS CDK]({% link _chapters/what-is-aws-cdk.md %}), to create the infrastructure.
38
+
The code that describes the infrastructure of your serverless app is placed in the `stacks/` directory of your project. SST uses [AWS CDK]({% link _chapters/what-is-aws-cdk.md %}), to create the infrastructure.
In the [previous chapter we configured a custom domain for our serverless API]({% link _chapters/custom-domains-in-serverless-apis.md %}). Now let's do the same for our frontend React.js app.
12
12
13
-
{%change%} In the `lib/FrontendStack.js` add the following below the `new sst.ReactStaticSite(` line.
13
+
{%change%} In the `stacks/FrontendStack.js` add the following below the `new sst.ReactStaticSite(` line.
14
14
15
15
```js
16
16
customDomain:
@@ -32,7 +32,7 @@ You won't need to set the `domainAlias` for the non-prod versions because we don
32
32
33
33
We need to use the custom domain URL of our API in our React app.
34
34
35
-
{%change%} Find the following line in `lib/FrontendStack.js`.
35
+
{%change%} Find the following line in `stacks/FrontendStack.js`.
36
36
37
37
```js
38
38
REACT_APP_API_URL:api.url,
@@ -48,7 +48,7 @@ Note that, if you are going to use a custom domain locally, you might need to re
48
48
49
49
We also need to update the outputs of our frontend stack.
50
50
51
-
{%change%} Replace the `this.addOutputs` call at the bottom of `lib/FrontendStack.js` with this.
51
+
{%change%} Replace the `this.addOutputs` call at the bottom of `stacks/FrontendStack.js` with this.
In the [previous chapter]({% link _chapters/purchase-a-domain-with-route-53.md %}) we purchased a new domain on [Route 53](https://aws.amazon.com/route53/). Now let's use it for our serverless API.
12
12
13
-
{%change%} In your `lib/ApiStack.js` add the following above the `defaultAuthorizationType: "AWS_IAM",` line.
13
+
{%change%} In your `stacks/ApiStack.js` add the following above the `defaultAuthorizationType: "AWS_IAM",` line.
14
14
15
15
```js
16
16
customDomain:
@@ -23,7 +23,7 @@ We could for example, base it on the stage name, `api-${scope.stage}.my-serverle
23
23
24
24
We also need to update the outputs of our API stack.
25
25
26
-
{%change%} Replace the `this.addOutputs` call at the bottom of `lib/ApiStack.js`.
26
+
{%change%} Replace the `this.addOutputs` call at the bottom of `stacks/ApiStack.js`.
Copy file name to clipboardexpand all lines: _chapters/deploy-a-serverless-app-with-dependencies.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ The short version is that:
18
18
19
19
In our [resources repo]({{ site.backend_ext_resources_github_repo }}) we are using SST to deploy our CDK app. CDK internally keeps track of the dependencies between stacks.
Copy file name to clipboardexpand all lines: _chapters/dynamically-generate-social-share-images-with-serverless.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ $ cd social-cards
82
82
83
83
The infrastructure in our app is defined using [CDK]({% link _chapters/what-is-aws-cdk.md %}). Currently we just have a simple API that invokes a Lambda function.
84
84
85
-
You can see this in `lib/MyStack.js`.
85
+
You can see this in `stacks/MyStack.js`.
86
86
87
87
```js
88
88
// Create a HTTP API
@@ -174,7 +174,7 @@ The `encoded_title` is a [Base64 encoded](https://en.wikipedia.org/wiki/Base64)
174
174
175
175
We are going to use [Puppeteer](https://developers.google.com/web/tools/puppeteer) to take these screenshots. We'll be using [a publicly available Lambda Layer](https://github.com/shelfio/chrome-aws-lambda-layer) for it. It allows us to skip having to compile Puppeteer specifically for AWS Lambda.
176
176
177
-
So the API definition in `lib/MyStack.js` now looks like this.
177
+
So the API definition in `stacks/MyStack.js` now looks like this.
178
178
179
179
```js
180
180
constapi=newsst.Api(this, "Api", {
@@ -408,7 +408,7 @@ If we visit our API multiple times, it takes a screenshot every time. This is bo
408
408
409
409
First, we'll create our S3 bucket.
410
410
411
-
In `lib/MyStack.js` above our API definition we have.
411
+
In `stacks/MyStack.js` above our API definition we have.
412
412
413
413
```js
414
414
// Create S3 bucket to store generated images
@@ -541,7 +541,7 @@ Now if you load your API endpoint a couple of times, you'll notice it is much fa
541
541
542
542
To make our requests even faster we'll add a CDN in front of our API. We'll use [CloudFront](https://aws.amazon.com/cloudfront/) for this.
543
543
544
-
In `lib/MyStack.js` we'll define our CloudFront distribution.
544
+
In `stacks/MyStack.js` we'll define our CloudFront distribution.
545
545
546
546
```js
547
547
// Create CloudFront Distribution
@@ -582,7 +582,7 @@ If you are looking to create a new domain, you can [follow this guide to purchas
582
582
583
583
Or if you have a domain hosted on another provider, [read this to migrate it to Route 53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html).
584
584
585
-
We can do this in our `lib/MyStack.js` by adding this block above the CloudFront definition.
585
+
We can do this in our `stacks/MyStack.js` by adding this block above the CloudFront definition.
586
586
587
587
```js
588
588
constrootDomain="serverless-stack.com";
@@ -640,7 +640,7 @@ if (useCustomDomain) {
640
640
}
641
641
```
642
642
643
-
Make sure to check out the full `lib/MyStack.js` source here — [{{ page.repo | remove: "https://" }}/blob/main/lib/MyStack.js]({{ page.repo }}/blob/main/lib/MyStack.js)
643
+
Make sure to check out the full `stacks/MyStack.js` source here — [{{ page.repo | remove: "https://" }}/blob/main/stacks/MyStack.js]({{ page.repo }}/blob/main/stacks/MyStack.js)
Copy file name to clipboardexpand all lines: _chapters/parameterize-serverless-resources-names.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ resources:
51
51
52
52
For CDK on the other hand we use [SST](https://github.com/serverless-stack/serverless-stack) to automatically parameterize our stack names. And use a helper method to parameterize specific resource names.
53
53
54
-
So for example in the `lib/index.js` file in our [resources repo]({{ site.backend_ext_resources_github_repo }}).
54
+
So for example in the `stacks/index.js` file in our [resources repo]({{ site.backend_ext_resources_github_repo }}).
55
55
56
56
``` javascript
57
57
export default function main(app) {
@@ -73,7 +73,7 @@ dev-notes-ext-infra-cognito
73
73
74
74
Where `dev` is the stage we are deploying to and `notes-ext-infra` is the name of our SST app, as specified in our `sst.json`.
75
75
76
-
For specific resources, such as CloudFormation exports, we use the `app.logicalPrefixedName` helper method. Here's an example from `lib/DynamoDBStack.js`.
76
+
For specific resources, such as CloudFormation exports, we use the `app.logicalPrefixedName` helper method. Here's an example from `stacks/DynamoDBStack.js`.
Copy file name to clipboardexpand all lines: _chapters/using-cognito-to-add-authentication-to-a-serverless-app.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ To understand this better we'll be referencing an example SST application on Git
20
20
21
21
This example SST app has a couple of key parts:
22
22
23
-
-**The `lib/` directory**: This contains the code that describes the infrastructure of your serverless app. It works by leveraging [AWS CDK](https://serverless-stack.com/chapters/what-is-aws-cdk.html) to create the infrastructure. This includes our API, our Cognito services, and our frontend static site.
23
+
-**The `stacks/` directory**: This contains the code that describes the infrastructure of your serverless app. It works by leveraging [AWS CDK](https://serverless-stack.com/chapters/what-is-aws-cdk.html) to create the infrastructure. This includes our API, our Cognito services, and our frontend static site.
24
24
-**The `src/` directory**: This is where the application code resides. The code that will run when your API is called.
25
25
-**The `frontend/` directory**: This is where our frontend React.js application is. It'll be connecting to our APIs.
26
26
@@ -43,7 +43,7 @@ Let’s start with looking at how to add Cognito User Pool to our app.
43
43
44
44
In the [previous chapter]({% link _chapters/how-to-add-authentication-to-a-serverless-app.md %}) we talked about the various parts of Cognito ([User Pools and Identity Pools]({% link _chapters/cognito-user-pool-vs-identity-pool.md %})).
45
45
46
-
SST makes it easy to add these to your application. In [`lib/MyStack.js`]({{ repo_url }}/lib/MyStack.js) you'll notice.
46
+
SST makes it easy to add these to your application. In [`stacks/MyStack.js`]({{ repo_url }}/stacks/MyStack.js) you'll notice.
47
47
48
48
```js
49
49
// Create a Cognito User Pool to manage auth
@@ -112,7 +112,7 @@ new Auth(this, "Auth", {
112
112
113
113
### Adding an API
114
114
115
-
Now let's look at how we can use Cognito to secure our API. In [`lib/MyStack.js`]({{ repo_url }}/lib/MyStack.js) of our example, you'll notice our SST [`Api`](https://docs.serverless-stack.com/constructs/Api) definition.
115
+
Now let's look at how we can use Cognito to secure our API. In [`stacks/MyStack.js`]({{ repo_url }}/stacks/MyStack.js) of our example, you'll notice our SST [`Api`](https://docs.serverless-stack.com/constructs/Api) definition.
116
116
117
117
```js
118
118
// Create an HTTP API
@@ -161,7 +161,7 @@ export async function handler() {
161
161
162
162
### Adding a React Static Site
163
163
164
-
We can now turn our attention to the frontend part of our application. In [`lib/MyStack.js`]({{ repo_url }}/lib/MyStack.js) take a look at the SST [`ReactStaticSite`](https://docs.serverless-stack.com/constructs/ReactStaticSite) definition.
164
+
We can now turn our attention to the frontend part of our application. In [`stacks/MyStack.js`]({{ repo_url }}/stacks/MyStack.js) take a look at the SST [`ReactStaticSite`](https://docs.serverless-stack.com/constructs/ReactStaticSite) definition.
165
165
166
166
```js
167
167
// Deploy our React app
@@ -187,7 +187,7 @@ The key here is that we are [setting the outputs from our backend as environment
187
187
4. Id of our Cognito Identity Pool
188
188
5. And the Id of the Cognito User Pool client
189
189
190
-
You can check out the rest of [`lib/MyStack.js`]({{ repo_url }}/lib/MyStack.js) for reference.
190
+
You can check out the rest of [`stacks/MyStack.js`]({{ repo_url }}/stacks/MyStack.js) for reference.
0 commit comments