Skip to content

Latest commit

 

History

History
80 lines (54 loc) · 3.96 KB

Readme.md

File metadata and controls

80 lines (54 loc) · 3.96 KB

Frontend Masters Course: Build Go Apps that Scale on AWS

This is a companion repo containing the code solutions for the Build Go Apps that Scale on AWS course on Frontend Masters

Setup Instructions

In order to complete this course, you should create an AWS account, install Go, the AWS CLI and the AWS CDK.

Install Go (preferably version > = 1.18)

Install the AWS CLI

CDK installed (use CDK command)

  • Download CDK
  • Make sure you bootstrap your environment with:
cdk bootstrap aws://ACCOUNT-NUMBER/REGION

Here's more info about boostrapping the CDK. Your ACCOUNT-NUMBER and REGION can be found in the AWS console or using the following AWS CLI commands:

  • Get your ACCOUNT-NUMBER using the following AWS CLI command aws sts get-caller-identity --query Account --output text
  • Get your REGION using the following AWS CLI command aws configure get region

CloudWatch Logs

Some users received CloudWatch logging errors during the API Gateway lessons. Logging to CloudWatch is not required, but you can prevent these errors by following these steps.

If you dont want logging, you can add CloudWatchRole: jsii.Bool(true) to the RestApiProps object.

Gopls Extension

Download the Gopls Extension for your editor

Code Solutions

All code for this course is written from scratch. The branches in this repo are code checkpoints for sections within the course:

  • The main branch contains everything you need for the Go Basics section
  • The chapter_0 branch contains the solution to the AWS & CDK section
  • branch chapter_1 branch contains the solution to the DynamoDB & Insertin Users section
  • branch chapter_2 branch contains the solution to the AAPI Gateway & Authentication Routes section
  • branch chapter_3 branch contains the solution to the JSON Web Tokens & Protected URLs section

Note: The code in the above branches may not match what was coded during the course. See the live_workshop branch for the final course code.

cURL Commands

At the end of the course, the API routes are tested with cURL commands. You can copy/paste these commands instead of typing them out.

Register

curl -X POST AWS_SERVER_URL/register -H "Content-Type: application/json" -d '{"username":"USERNAME", "password":"PASSWORD"}'

Login

curl -X POST AWS_SERVER_URL/login -H "Content-Type: application/json" -d '{"username":"USERNAME", "password":"PASSWORD"}'

Access Protected Route

curl -X GET AWS_SERVER_URL/protected -H "Content-Type: application/json" -H "Authorization: Bearer JWT_TOKEN"

Remove infrastructure create with CDK

To remove the infrastructure created with the AWS CDK, run cdk destory.

Before running cdk destroy, you'll want to ensure you've added RemovalPolicy: awscdk.RemovalPolicy_DESTROY in the awsdynamodb.TableProps.