Skip to content

Commit

Permalink
TS update and archiving old chapters (#730)
Browse files Browse the repository at this point in the history
* Guide with Typescript & PNPM (#719)

As I work through the guide, I add notes and I also read the comments and adding any relevant notes I see as of May 18(ish).

~~ Site Wide

**** Changes
- Added .idea to .gitignore
- Added .idea to Jekyll Exclude list

**** Notes
- [ ] Consider accessibility features
    * http://www.goring.org/resources/accessibility.html
    * https://github.com/benbalter/ra11y
    * adding an indicator for links that open in new tabs
- [ ] Consider adding "Archived" banner to the top of any parts of the site that are kept but are not intended for current reference for example, all the pages [in this section](http://localhost:4000/guide.html#archives).

~~ Guide

**** Changes
- Updated External Links to open a new tab.
- Updated SASS for blockquote within post-content to not be enormous.
- Added a few classes for Notes and Asides

**** Notes
- [ ] TODO: Resolve SST Console Warning [See the migration guide](https://a.co/7PzMCcy)

      (node:85684) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.

      Please migrate your code to use AWS SDK for JavaScript (v3).
      For more information, check the migration guide at https://a.co/7PzMCcy
      (Use `node --trace-warnings ...` to show where the warning was created)
      16:14:43.391

- [ ] TODO: Clean up legacy guide files so it doesn't clutter the current fileset.
- [ ] TODO: Correctly manage the path_id variable in code examples to ensure they are present without code duplication.
- [ ] TODO: Switch from Amplify API to RestApi or GraphQLAPI based on note in API.d.ts (See Warning in console.sst.dev)
- [ ] Consider adding a chapter on accessibility in the frontend creation section.
  * [React Accessibility](https://legacy.reactjs.org/docs/accessibility.html) - New Accessibility guides are still pending based on announcement on 3/16/2023
  * https://www.freecodecamp.org/news/react-accessibility-tools-build-accessible-react-apps/
  * https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility

~~ Chapter Specific

@@@ What Does This Guide Cover
**** Notes (From Discourse comments)
- [ ] [Consider using Next.js for the guide](https://discourse.sst.dev/t/what-does-this-guide-cover/83/7?u=christinep2)
- [ ] [Consider switching example to React Native](https://discourse.sst.dev/t/what-does-this-guide-cover/83/8?u=christinep2)

@@@ How to Get Help?
_no specific changes_

@@@ What is Serverless?
**** Changes
 - Removed link to the What is AWS Lambda chapter as it encourages skipping the rest of the current page.

@@@ What is AWS Lambda?
**** Notes
- [ ] [Consider decreasing specificity in Lambda Spec Description](/chapters/what-is-aws-lambda.html#lambda-specs) - As AWS modifies its offerings, the description can be outdated.  By speaking in generalities and linking directly to AWS for specificity the document will be less fragile.

@@@ Why Create Serverless Apps?
**** Notes
- [ ] Consider specifying a timeframe on the cost calculation to account for pricing changes over time.

@@@ Create an AWS Account
**** Changes
- Tested steps with a new AWS Account.
- Removed reference to specific language since they changed the call to action.  Also removed screenshot as it was outdated.

@@@ Create an IAM User
**** Changes
- Updated chapter instructions & screenshots.
- Updated screenshots at 1280x783.
- Screenshots located in `create-iam-user`
- Left old screenshots in `iam-user` for other languages as I couldn't update them to match the new instructions.

@@@ Configure the AWS CLI
**** Changes
- Tested steps with a clean install on Mac.
**** Notes
- [ ] Consider adding [Chocolatey](https://chocolatey.org/) [instructions for Windows](https://discourse.sst.dev/t/configure-the-aws-cli/86/3?u=christinep2.
- [ ] (Consider adding instructions for *NIX flavors.)[https://discourse.sst.dev/t/configure-the-aws-cli/86/5?u=christinep2]
- [ ] Consider adding a link to the AWS instructions instead, in case that is easier.

@@@ What is SST?
**** Changes
- Removed link to other chapters as it encourages skipping the current document
- Added links for the specific IDE Instructions
**** Notes
- [ ] Consider removing the penultimate sentence regarding the alternative guide since it is archived.

@@@ What is Infrastructure as Code?
**** Changes
- Added "using CDK" into the first sentence based on the confusion mentioned in the chapter comments

@@@ What is AWS CDK?
**** Changes
- Changed references to pnpm
- Added question mark to title to match the other titles in the section and the title of the comments page.

@@@ Create an SST app
**** Changes
- updated to pnpm

**** Notes
- [ ] Need to update Next Steps command line output as follows
  - cd notes
  - pnpm add (or npm, or yarn)
  - pnpm exec sst dev

@@@ Create a Hello World API
**** Changes
- updated to pnpm
- Added instructions for Safari et. al. users found in [this discord thread](https://discord.com/channels/983865673656705025/1102040862143303751/1102073623516282890)

**** Notes
- [ ] Safari instructions for mkcert usage are not working.  Need to investigate further.

@@@ Initialize a Github Repo
_no specific changes_

@@@ Create a DynamoDB Table in SST
**** Changes
- updated to pnpm
- updated to typescript
- Added clarification as specified in comment

**** Questions
1. Regarding the statement "There’s no specific reason why we are creating a separate stack for these resources." Would it be fair to say that the decision to have separate stacks increases application maintainability?  It seems like it could fall under the principle of "separation of concerns".
2. Why is the Hello World API still present in console after this step?

@@@ Create a S3 Bucket in SST
**** Changes
- updated to pnpm
- updated to typescript
- small wording changes
- moved bucket in return to above table instead of below, matching location in the stack file and alphabetically ordered.
- git commit as a one line command to facilitate using the copy option for the code.

@@@ Review Our App Architecture
_no specific changes_

@@@ Add an API to Create a Note
**** Changes
- updated to pnpm
- updated to typescript
- Added info about DRYness and maintainability to the refactor section.

**** Notes
- Should we uninstall the aws-sdk (or @AWS-SDK) from functions when we install it into core?
- Should the user re-test after the refactor to ensure it still works?
- Do we need to add [this note](https://discourse.sst.dev/t/add-an-api-to-create-a-note/2451/18?u=christinep2) for Windows users into the guide?
- Referenced [this error handling blog post](https://kentcdodds.com/blog/get-a-catch-block-error-message-with-typescript) for the error code in handler.
- I'm seeing a delay as I add the API endpoints with seeing them in the console.  I experienced on two different run-throughs, is this expected? If so, can we add a note to that effect at this point so people don't try and debug?

@@@ Add an API to Get/Put/Patch/Delete a Note
**** Changes
- updated to pnpm
- updated to typescript

@@@ Adding Auth to Our Serverless App
**** Changes
- Updated to typescript
- Updated to use docs variable instead of hardcoded url

@@@ Secure Our Serverless APIs
**** Changes
- Updated to typescript
- Switched to PNPM
- Used optional chaining operator for `requestContext.authorizer`. Should we have a different solution?

@@@ Setup a Stripe Account
**** Changes
- Redo screenshots and update text to match new UI

@@@ Handling Secrets in SST
**** Changes
- Rewrite to use the SST Secrets CLI based on the information found here: https://docs.sst.dev/config#should-i-use-configsecret-or-env-for-secrets

@@@ Add an API to Handle Billing
**** Changes
- Updated to typescript
- Switched to PNPM

**** Notes
- [ ] Consider not using [nested ternary operators](https://medium.com/@benlmsc/stop-using-nested-ternary-operators-heres-why-53e7e078e65a).

@@@ Unit Tests in Serverless
**** Changes
- Switch to Typescript for testing
- Switch to PNPM
- Add instructions to add Vite Test to workspace

**** Notes
- [ ] Consider including tests as we build out the API instead of at the end, or at least adding a note that this is a preferred approach for ensuring properly tested code.

@@@ Handle CORS in Serverless APIs
**** Changes
- Switch to Typescript
- Switch to PNPM

@@@ Handle CORS in S3 for File Uploads
**** Changes
- Switch to Typescript
- Switch to PNPM

@@@ Create a New React.js App
**** Changes
- Switch to Typescript
- Switch to PNPM
- Minor wording changes

**** Notes
- [ ] Need to [replace create-react-app with one of the recommended solutions](facebook/create-react-app#13072) as create-react-app is being deprecated.
- [ ] Consider adding tests alongside new code from this point forward.

@@@ Set up Custom Fonts
**** Changes
- Minor wording changes
- Update final screenshot to show tsx file instead of js file

@@@ Set up Bootstrap
**** Changes
- Switch to Typescript
- Switch to PNPM
- Minor wording changes

@@@ Handle Routes with React Router
**** Changes
- Switch to Typescript
- Switch to PNPM
- Minor wording changes

@@@ Create Containers
**** Changes
- Switch to Typescript
- Switch to PNPM
- Minor wording changes

@@@ Adding Links in the Navbar
**** Changes
- Switch to PNPM
- Switch to Typescript
- Minor wording changes

@@@ Handle 404s
**** Changes
- Switch to Typescript
- Minor wording changes

@@@ Configure AWS Amplify
**** Changes
- Switch to Typescript
- Switch to PNPM
- Minor wording changes

@@@ Create a Login Page
**** Changes
- Switch to Typescript
- Switch to PNPM
- Minor wording changes

@@@ Login with AWS Cognito
**** Changes
- Switch to Typescript
- Switch to PNPM
- Minor wording changes

@@@ Add the Session to the State
**** Changes
- Switch to Typescript

@@@ Load the State from the Session
**** Changes
- Switch to Typescript
- Move import of UseEffect above explainer so that consumer is not sidetracked by the import not being present.

@@@ Clear the Session on Logout
**** Changes
- Switch to Typescript

@@@ Redirect on Login and Logout
**** Changes
- Switch to Typescript

@@@ Give Feedback While Logging In
**** Changes
- Switch to Typescript

@@@ Create a Custom React Hook to Handle Form Fields
**** Changes
- Switch to Typescript

@@@ Create a Signup Page
No Changes

@@@ Create the Signup Form
**** Changes
- Switch to Typescript
- Minor wording changes

@@@ Signup with AWS Cognito
**** Changes
- Switch to Typescript
- Minor wording changes
@@@ Notes
- [ ] Do we want to add the handling for UserExists in? https://discourse.sst.dev/t/signup-with-aws-cognito/130/74?u=christinep2

@@@ Add the Create Note Page
**** Changes
- Switch to Typescript
- Minor wording changes

@@@ Call the Create API
**** Changes
- Switch to Typescript
- Minor wording changes

@@@ Upload a File to S3
**** Changes
- Switch to Typescript

@@@ Upload a File to S3
**** Changes
- Switch to Typescript
- Added helpful note from @sometimescasey

**** Notes
- [ ] Update troubleshooting tips if outdated.

@@@ List All the Notes
**** Changes
- Switch to Typescript
- Minor wording changes

@@@ Call the List API
**** Changes
- Switch to Typescript
- Move Import immediately after adding code so consumer is not distracted by errors

@@@ Display a Note
**** Changes
- Switch to Typescript

@@@ Render the Note Form
**** Changes
- Switch to Typescript
- Minor wording changes
- Move Import immediately after adding code so consumer is not distracted by errors

@@@ Save Changes to a Note
**** Changes
- Switch to Typescript
- Minor wording changes

@@@ Delete a Note
**** Changes
- Switch to Typescript
- Minor wording changes

@@@ Create a Settings Page
**** Changes
- Switch to Typescript
- Minor wording changes

@@@ Add Stripe Keys to Config
**** Changes
- Switch to Typescript
- Switch to PNPM
- Minor wording changes

@@@ Create a Billing Form
**** Changes
- Switch to Typescript
- Switch to PNPM

@@@ Connect the Billing Form
**** Changes
- Switch to Typescript
- Switch to PNPM

@@@ Set up Secure Pages
No Changes

@@@ Create a Route That Redirects
**** Changes
- Switch to Typescript

@@@ Use the Redirect Routes
**** Changes
- Switch to Typescript

@@@ Redirect on Login
**** Changes
- Switch to Typescript

@@@ Purchase a Domain with Route 53
Skipped.

@@@ Custom Domains in serverless APIs
**** Changes
- Switch to Typescript
- Minor wording changes

@@@ Custom Domains for React Apps on AWS
**** Changes
- Switch to Typescript/PNPM
- Minor wording changes

**** Notes
- [ ] I tried switching the domain and the alias so that I could easily remove the domain alias and use it for my "real" app and leave the subdomain for this demo, but it erred with the message.
    ```
      Error: Validation failed with the following errors:
      [prod-notes-FrontendStack/ReactSite/Redirect/RedirectCertificate] DNS zone www-notes.manuals4life.com is not authoritative for certificate domain name manuals4life.com
    ```
    In orde to keep the statement "You can switch these around so that the root domain redirects to the `www.` version as well.", I believe we'd need additional information dealing with the CAA record or whatever tripped it up.

@@@ Getting Production Ready
No Changes

@@@ Creating a CI/CD Pipeline for serverless
No Changes (other than the global new tab for external links)

@@@ Setting up Your Project on Seed
**** Changes
- Switch References to Typescript
- Minor wording changes
**** Notes
- [ ] Needs new Screenshots using serverless-stack demo notes app.
- [ ] Might add a screenshot pointing at settings in the UI?

@@@ Configure Secrets in Seed
**** Changes
- Switch References to sst secret instead of .env.local
- Minor wording changes

@@@ Deploying Through Seed
**** Changes
- minor wording changes

@@@ Debugging Full-Stack Serverless Apps
No Changes

@@@ Setup Error Reporting in React
**** Changes
- Switch to Typescript
- Switched to `pnpm add @sentry/react` from `@sentry/browser`
- Added an ErrorInfoType

**** Notes
- [ ] Needs new Screenshots

@@@ Report API Errors in React
**** Changes
- Switch to Typescript

@@@ Setup an Error Boundary in React
**** Changes
- Switch to Typescript
- Change multiline ternary to if/else
- Updated screenshot for react error
**** Notes
- [ ] Needs new Screenshots for Sentry confirmations

@@@ Setup Error Logging in Serverless
**** Changes
- Switch to Typescript

@@@ Logic Errors in Lambda Functions
**** Changes
- Switch to Typescript
**** Notes
- [ ] Logging extra information is incorrectly displaying `[object Object]`

@@@ Unexpected Errors in Lambda Functions
**** Changes
- Switch references to Typescript

@@@ Errors Outside Lambda Functions
**** Changes
- Switch references to Typescript

@@@ Errors in API Gateway
**** Changes
- Switch references to Typescript

@@@ Wrapping Up
**** Changes
- Switch references to PNPM

~~ Additional Guide Information Pages still in use:

@@@ Auth In Serverless Apps
**** Changes
- Updated to typescript
- Updated referenced pages What is IAM and What is an ARN

@@@ What is IAM / What is an ARN
**** Changes
- Updated text to remove wording implying it is a step in the guide

@@@ Mapping Cognito Identity Id and User Pool Id

@@@ Cognito User Pool vs Identity Pool

@@@ Setting serverless environment variables in a React app
- Updated to pnpm
- Updated to typescript

~~ Outstanding Changes

@@@ Extra Credit series of chapters on user management
- [ ] TODO: Update these as they are referenced from "Give Feedback While Logging In" (Specifically links to http://localhost:4000/chapters/manage-user-accounts-in-aws-amplify.html)

Co-authored-by: Jay <[email protected]>

* Edits

* Edits

* Reviewing changes

* Removing test code

* Edits

* Setting up sst

* Moving to archives

* Updating links to archives

* Adding redirects

* Adding redirects

---------

Co-authored-by: Christine Panus <[email protected]>
  • Loading branch information
jayair and ChristineP2 committed Aug 30, 2023
1 parent 1b87f3b commit 18e9193
Show file tree
Hide file tree
Showing 367 changed files with 8,189 additions and 2,352 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Session.vim
.sst/
node_modules/
_site
.sw*
.*.sw*
Expand All @@ -7,3 +9,4 @@ _site
.jekyll-cache/
.DS_Store
vendor/
.idea/
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ GEM

PLATFORMS
arm64-darwin-21
x86_64-darwin-22

DEPENDENCIES
jekyll (= 4.1.1)
Expand All @@ -81,7 +82,7 @@ DEPENDENCIES
webrick (~> 1.7)

RUBY VERSION
ruby 3.0.4p208
ruby 2.6.10p210

BUNDLED WITH
2.3.20
2.4.5
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<p align="center">
<p style="text-align: center;">
<a href="https://sst.dev/">
<img alt="SST" src="https://raw.githubusercontent.com/sst/identity/main/variants/sst-full.svg" width="300" />
</a>
</p>


<p align="center">
<a href="https://sst.dev/discord"><img alt="Discord" src="https://img.shields.io/discord/983865673656705025?style=flat-square&label=Discord" /></a>
<a href="https://twitter.com/sst_dev"><img alt="Twitter" src="https://img.shields.io/badge/Twitter-26a7de?style=flat-square" /></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ lang: en
description: We are going to create a Lambda function for our serverless billing API. It will take the Stripe token that is passed in from our app and use the Stripe JS SDK to process the payment.
ref: add-a-billing-api
comments_id: add-a-billing-api/170
redirect_from: /chapters/add-a-billing-api.html
---

Now let's get started with creating our billing API. It is going to take a Stripe token and the number of notes the user wants to store.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ lang: en
ref: add-a-create-note-api
description: To allow users to create notes in our note taking app, we are going to add a create note POST API. To do this we are going to add a new Lambda function to our Serverless Framework project. The Lambda function will save the note to our DynamoDB table and return the newly created note.
comments_id: add-a-create-note-api/125
redirect_from: /chapters/add-a-create-note-api.html
---

Let's get started on our backend by first adding an API to create a note. This API will take the note object as the input and store it in the database with a new id. The note object will contain the `content` field (the content of the note) and an `attachment` field (the URL to the uploaded file).
Expand Down Expand Up @@ -67,7 +68,7 @@ There are some helpful comments in the code but we are doing a few simple things
- The AWS JS SDK assumes the region based on the current region of the Lambda function. So if your DynamoDB table is in a different region, make sure to set it by calling `AWS.config.update({ region: "my-region" });` before initializing the DynamoDB client.
- Parse the input from the `event.body`. This represents the HTTP request body.
- It contains the contents of the note, as a string — `content`.
- It also contains an `attachment`, if one exists. It's the filename of file that has been uploaded to [our S3 bucket]({% link _chapters/create-an-s3-bucket-for-file-uploads.md %}).
- It also contains an `attachment`, if one exists. It's the filename of file that has been uploaded to [our S3 bucket]({% link _archives/create-an-s3-bucket-for-file-uploads.md %}).
- We read the name of our DynamoDB table from the environment variable using `process.env.tableName`. We'll be setting this in our `serverless.yml` below. We do this so we won't have to hardcode it in every function.
- The `userId` is the id for the author of the note. For now we are hardcoding it to `123`. Later we'll be setting this based on the authenticated user.
- Make a call to DynamoDB to put a new object with a generated `noteId` and the current date as the `createdAt`.
Expand Down Expand Up @@ -129,7 +130,7 @@ functions:
method: post
```
Here we are adding our newly added create function to the configuration. We specify that it handles `post` requests at the `/notes` endpoint. This pattern of using a single Lambda function to respond to a single HTTP event is very much like the [Microservices architecture](https://en.wikipedia.org/wiki/Microservices). We discuss this and a few other patterns in the chapter on [organizing Serverless Framework projects]({% link _chapters/organizing-serverless-projects.md %}).
Here we are adding our newly added create function to the configuration. We specify that it handles `post` requests at the `/notes` endpoint. This pattern of using a single Lambda function to respond to a single HTTP event is very much like the [Microservices architecture](https://en.wikipedia.org/wiki/Microservices). We discuss this and a few other patterns in the chapter on [organizing Serverless Framework projects]({% link _archives/organizing-serverless-projects.md %}).

The `environment:` block allows us to define environment variables for our Lambda function. These are made available under the `process.env` Node.js variable. In our specific case, we are using `process.env.tableName` to access the name of our DynamoDB table.

Expand Down Expand Up @@ -167,7 +168,7 @@ If you have multiple profiles for your AWS SDK credentials, you will need to exp
$ AWS_PROFILE=myProfile serverless invoke local --function create --path mocks/create-event.json
```

Where `myProfile` is the name of the AWS profile you want to use. If you need more info on how to work with AWS profiles in Serverless, refer to our [Configure multiple AWS profiles]({% link _chapters/configure-multiple-aws-profiles.md %}) chapter.
Where `myProfile` is the name of the AWS profile you want to use. If you need more info on how to work with AWS profiles in Serverless, refer to our [Configure multiple AWS profiles]({% link _archives/configure-multiple-aws-profiles.md %}) chapter.

The response should look similar to this.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ lang: en
ref: add-a-delete-note-api
description: To allow users to delete their notes in our note taking app, we are going to add a DELETE note API. To do this we will add a new Lambda function to our Serverless Framework project. The Lambda function will delete a user’s note in the DynamoDB table.
comments_id: add-a-delete-note-api/153
redirect_from: /chapters/add-a-delete-note-api.html
---

Finally, we are going to create an API that allows a user to delete a given note.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ lang: en
ref: add-a-get-note-api
description: To allow users to retrieve a note in our note taking app, we are going to add a GET note API. To do this we will add a new Lambda function to our Serverless Framework project. The Lambda function will retrieve the note from our DynamoDB table.
comments_id: add-a-get-note-api/132
redirect_from: /chapters/add-a-get-note-api.html
---

Now that we created a note and saved it to our database. Let's add an API to retrieve a note given its id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ lang: en
ref: add-a-list-all-the-notes-api
description: To allow users to retrieve their notes in our note taking app, we are going to add a list note GET API. To do this we will add a new Lambda function to our Serverless Framework project. The Lambda function will retrieve all the user’s notes from the DynamoDB table.
comments_id: add-a-list-all-the-notes-api/147
redirect_from: /chapters/add-a-list-all-the-notes-api.html
---

Now we are going to add an API that returns a list of all the notes a user has.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ lang: en
ref: add-an-update-note-api
description: To allow users to update their notes in our note taking app, we are going to add an update note PUT API. To do this we will add a new Lambda function to our Serverless Framework project. The Lambda function will update a user’s note in the DynamoDB table.
comments_id: add-an-update-note-api/144
redirect_from: /chapters/add-an-update-note-api.html
---

Now let's create an API that allows a user to update a note with a new note object given its id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ title: Add Support for ES6 and TypeScript
date: 2016-12-29 12:00:00
lang: en
ref: add-support-for-es6-and-typescript
description: AWS Lambda supports Node.js v10.x and v12.x. However, to use ES 6 features or TypeScript in our Serverless Framework project we need to use Babel, Webpack 5, and a ton of other packages. We can do this by using the serverless-bundle plugin to our project.
comments_id: add-support-for-es6-es7-javascript/128
redirect_from:
- /chapters/add-support-for-es6-javascript.html
- /chapters/add-support-for-es6-es7-javascript.html
description: AWS Lambda supports Node.js v10.x and v12.x. However, to use ES 6 features or TypeScript in our Serverless Framework project we need to use Babel, Webpack 5, and a ton of other packages. We can do this by using the serverless-bundle plugin to our project.
comments_id: add-support-for-es6-es7-javascript/128
- /chapters/add-support-for-es6-and-typescript.html
---

AWS Lambda supports Node.js v10.x, v12.x, and v14.x. However, the supported syntax is a little different when compared to the more advanced ECMAScript flavor of JavaScript that our frontend React app supports. It makes sense to use similar ES features across both parts of the project – specifically, we'll be relying on ES imports/exports in our handler functions.
Expand All @@ -26,7 +27,7 @@ To help with this we created, [`serverless-bundle`](https://github.com/AnomalyIn
- Supports transpiling unit tests with [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jest)
- Source map support for proper error messages

It's automatically included in the starter project we used in the previous chapter — [`serverless-nodejs-starter`]({% link _chapters/serverless-nodejs-starter.md %}). For TypeScript, we have a starter for that as well — [`serverless-typescript-starter`](https://github.com/AnomalyInnovations/serverless-typescript-starter).
It's automatically included in the starter project we used in the previous chapter — [`serverless-nodejs-starter`]({% link _archives/serverless-nodejs-starter.md %}). For TypeScript, we have a starter for that as well — [`serverless-typescript-starter`](https://github.com/AnomalyInnovations/serverless-typescript-starter).

However, if you are looking to add ES6 and TypeScript support to your existing Serverless Framework projects, you can do this by installing [serverless-bundle](https://github.com/AnomalyInnovations/serverless-bundle):

Expand Down Expand Up @@ -89,7 +90,7 @@ You should see something like this in your terminal.

In the above command we are asking Serverless Framework to (locally) invoke a Lambda function called `hello`. This in turn will run the `hello` method that we are exporting in our `handler.js`.

Here we are directly invoking the Lambda function. Though once deployed, we'll be invoking this function through the `/hello` API endpoint (as we [talked about in the last chapter]({% link _chapters/setup-the-serverless-framework.md %})).
Here we are directly invoking the Lambda function. Though once deployed, we'll be invoking this function through the `/hello` API endpoint (as we [talked about in the last chapter]({% link _archives/setup-the-serverless-framework.md %})).

Now we are almost ready to deploy our Lambda function and API. But before we do that let's quickly look at one of the other things that's been set up for us in this starter project.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description: Use the AWS Amplify Auth.changePassword method to support change pa
date: 2018-04-15 00:00:00
code: user-management
comments_id: allow-users-to-change-passwords/507
redirect_from: /chapters/allow-users-to-change-passwords.html
---

For our [Serverless notes app](https://demo.sst.dev), we want to allow our users to change their password. Recall that we are using Cognito to manage our users and AWS Amplify in our React app. In this chapter we will look at how to do that.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description: Use the AWS Amplify Auth.updateUserAttributes method to support cha
date: 2018-04-16 00:00:00
code: user-management
comments_id: allow-users-to-change-their-email/508
redirect_from: /chapters/allow-users-to-change-their-email.html
---

We want the users of our [Serverless notes app](https://demo.sst.dev) to be able to change their email. Recall that we are using Cognito to manage our users and AWS Amplify in our React app. In this chapter we will look at how to do that.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: API Gateway and Lambda Logs
description: To view logs for your serverless APIs on AWS, CloudWatch needs to be enabled for API Gateway and Lambda. CloudWatch logs are ordered by Log Groups and Log Stream. Lambda CloudWatch logs can also be viewed using the Serverless CLI with the “serverless logs” command.
date: 2018-04-03 00:00:00
comments_id: api-gateway-and-lambda-logs/31
redirect_from: /chapters/api-gateway-and-lambda-logs.html
---

Logging is an essential part of building backends and it is no different for a serverless API. It gives us visibility into how we are processing and responding to incoming requests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: Backups in DynamoDB
date: 2018-04-06 12:00:00
description: Amazon DynamoDB allows you to create On-demand backups and enable Point-in-time recovery with a single click. Backups are fully-managed, extremely fast, and do not impact performance. In this chapter we look at the two ways to backup and restore DynamoDB tables.
comments_id: backups-in-dynamodb/705
redirect_from: /chapters/backups-in-dynamodb.html
---

An important (yet overlooked) aspect of having a database powering your web application are, backups! In this chapter we are going to take a look at how to configure backups for your DynamoDB tables.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: Best Practices for Building Serverless Apps
description: In this section of the guide we'll be covering the best practices for developing and maintaining large Serverless applications. It builds on what we've covered so far and it extends the demo notes app that we built in the first section. It's intended for teams as opposed to individual developers. It's meant to give you a foundation that scales as your app (and team) grows.
date: 2019-10-03 00:00:00
comments_id: best-practices-for-building-serverless-apps/1315
redirect_from: /chapters/best-practices-for-building-serverless-apps.html
---

In this section of the guide we'll be covering the best practices for developing and maintaining large Serverless applications. It builds on what we've covered so far and it extends the [demo notes app]({{ site.demo_url }}) that we built in the first section. It's intended for teams as opposed to individual developers. It's meant to give you a foundation that scales as your app (and team) grows.
Expand Down Expand Up @@ -41,23 +42,23 @@ Here is a rough rundown of the topics covered in this section of the guide.

We are covering primarily the backend Serverless portion. The frontend flow works relatively the same way as what we covered in the first section. We also found that there is a distinct lack of best practices for building Serverless backends as opposed to React apps.

- [Organizing large Serverless apps]({% link _chapters/organizing-serverless-projects.md %})
- [Sharing resources using cross-stack references]({% link _chapters/cross-stack-references-in-serverless.md %})
- [Sharing code between services]({% link _chapters/share-code-between-services.md %})
- [Sharing API endpoints across services]({% link _chapters/share-an-api-endpoint-between-services.md %})
- [Configuring environments]({% link _chapters/environments-in-serverless-apps.md %})
- [Using separate AWS accounts to manage environments ]({% link _chapters/structure-environments-across-aws-accounts.md %})
- [Parameterizing resource names]({% link _chapters/parameterize-serverless-resources-names.md %})
- [Managing environment specific configs]({% link _chapters/manage-environment-related-config.md %})
- [Best practices for handling secrets]({% link _chapters/storing-secrets-in-serverless-apps.md %})
- [Sharing domains across environments]({% link _chapters/share-route-53-domains-across-aws-accounts.md %})
- [Development lifecycle]({% link _chapters/working-on-serverless-apps.md %})
- [Working locally]({% link _chapters/invoke-api-gateway-endpoints-locally.md %})
- [Creating feature environments]({% link _chapters/creating-feature-environments.md %})
- [Creating pull request environments]({% link _chapters/creating-pull-request-environments.md %})
- [Promoting to production]({% link _chapters/promoting-to-production.md %})
- [Handling rollbacks]({% link _chapters/rollback-changes.md %})
- [Using AWS X-Ray to trace Lambda functions]({% link _chapters/tracing-serverless-apps-with-x-ray.md %})
- [Organizing large Serverless apps]({% link _archives/organizing-serverless-projects.md %})
- [Sharing resources using cross-stack references]({% link _archives/cross-stack-references-in-serverless.md %})
- [Sharing code between services]({% link _archives/share-code-between-services.md %})
- [Sharing API endpoints across services]({% link _archives/share-an-api-endpoint-between-services.md %})
- [Configuring environments]({% link _archives/environments-in-serverless-apps.md %})
- [Using separate AWS accounts to manage environments ]({% link _archives/structure-environments-across-aws-accounts.md %})
- [Parameterizing resource names]({% link _archives/parameterize-serverless-resources-names.md %})
- [Managing environment specific configs]({% link _archives/manage-environment-related-config.md %})
- [Best practices for handling secrets]({% link _archives/storing-secrets-in-serverless-apps.md %})
- [Sharing domains across environments]({% link _archives/share-route-53-domains-across-aws-accounts.md %})
- [Development lifecycle]({% link _archives/working-on-serverless-apps.md %})
- [Working locally]({% link _archives/invoke-api-gateway-endpoints-locally.md %})
- [Creating feature environments]({% link _archives/creating-feature-environments.md %})
- [Creating pull request environments]({% link _archives/creating-pull-request-environments.md %})
- [Promoting to production]({% link _archives/promoting-to-production.md %})
- [Handling rollbacks]({% link _archives/rollback-changes.md %})
- [Using AWS X-Ray to trace Lambda functions]({% link _archives/tracing-serverless-apps-with-x-ray.md %})

We think these concepts should be a good starting point for your projects and you should be able to adapt them to fit your use case!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: Code Splitting in Create React App
description: Code splitting in Create React App is an easy way to reduce the size of your React.js app bundle. To do this in an app using React Router v5, we can asynchronously load our routes using the dynamic import() method that Create React App supports.
date: 2018-04-17 00:00:00
comments_id: code-splitting-in-create-react-app/98
redirect_from: /chapters/code-splitting-in-create-react-app.html
---

Code Splitting is not a necessary step for building React apps. But feel free to follow along if you are curious about what Code Splitting is and how it can help larger React apps.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ lang: en
ref: cognito-user-pool-vs-identity-pool
description: Amazon Cognito User Pool is a service that helps manage your users and the sign-up and sign-in functionality for your mobile or web app. Cognito Identity Pool or Cognito Federated Identities is a service that uses identity providers (like Google, Facebook, or Cognito User Pool) to secure access to other AWS resources.
comments_id: cognito-user-pool-vs-identity-pool/146
redirect_from: /chapters/cognito-user-pool-vs-identity-pool.html
---

We often get questions about the differences between the Cognito User Pool and the Identity Pool, so it is worth covering in detail. The two can seem a bit similar in function and it is not entirely clear what they are for. Let's first start with the official definitions.
Expand Down
Loading

0 comments on commit 18e9193

Please sign in to comment.