Skip to content

Instantly share code, notes, and snippets.

View micahwierenga's full-sized avatar
💭
Learning

Micah Wierenga micahwierenga

💭
Learning
View GitHub Profile
@micahwierenga
micahwierenga / static_site_s3_route_53_lab.md
Last active February 21, 2024 01:35
Static Websites and Custom Domains Using Amazon S3 and Amazon Route 53

Static Websites and Custom Domains Using S3 and Route 53

You have a website that needs to display a few images, as well as your content. It doesn't need to collect user data like their names, email, and password, nor does it need to upload profile images. It's simple, which is why this lab will show you how to use Amazon Simple Storage Service (S3) to host your site.

You also have a custom domain that you want to use for this website. Once we've hosted your site on S3, we'll use Amazon Route 53 to ensure that users can find it using your chosen domain.

In order to acquire these skills, we're going to build a pet adoption site that displays some text and a few images. Then we're going to route a custom domain to this website in order to make it easier for users to discover your site.

Contents

Big-O Notation Exercises

What is the worst-case time complexity for the following algorithms?

#1

function wordOccurrence(word, phrase){
  let result = 0
  const array  = phrase.split(' ')

Creating a Library App

Setup

  1. cd ~/code
  2. express -e library-app
  3. cd library-app
  4. npm i
  5. npm i mongoose
  6. Rename app.js to server.js

OAuth: Understanding the Logical Order

There are a few different processes that we need to understand when it comes to OAuth: 1) What happens when the server starts, 2) What happens when an authentication request is handled, and 3) What happens when a normal route with authorization is handled. We won't be writing code in this order, but these lists will help you understand their part in the processes.

When the Server Starts

  1. Load express-session and passport libraries in server.js:

    Code

OAuth: Understanding the Logical Order

There are a few different processes that we need to understand when it comes to OAuth: 1) What happens when the server starts, 2) What happens when an authentication request is handled, and 3) What happens when a normal route with authorization is handled. We won't be writing code in this order, but these lists will help you understand their part in the processes.

When the Server Starts

  1. Load express-session and passport libraries.

In server.js:

Mongoose Flights Lab, Part 3: Supplement

These clarifications and wireframes are meant to be a supplement to Mongoose Flights Lab, Part 3.

The Ticket Schema

First, you're to create a Ticket schema with the following fields/properties:

  • seat
  • price

Mongoose Flights Lab, Part 2: Supplement

These clarifications and wireframes are meant to be a supplement to Mongoose Flights Lab, Part 2.

The Destination Schema

First, you're to create a Destination schema with the following fields/properties (and this schema should be embedded in the Flight schema, which should be updated to have a destinations field/property):

  • airport
  • arrival

Mongoose Flights Lab, Part 1: Supplement

These clarifications and wireframes are meant to be a supplement to Mongoose Flights Lab, Part 1.

The Flight Schema

First, you're to create a Flight schema with the following fields/properties:

  • airline
  • airport

Guess the Numbers Lab Pseudocode

const game = {
  title: 'Guess the Number!',
  biggestNum: 100,
  smallestNum: 1,
  secretNum: null,
  prevGuesses: [],
  play: function() {

Alternative Tic-Tac-Toe Pseudocode/Instructions

1. In HTML, create 9 divs that each share a class and that each have a unique id.
2. In JS, create a variable called "marker" with the initial value of 'X'.
3. Cache each div in a separate variable.
4. Using those variables, add click event listeners to each.
5. Above the event listeners, create a function called renderMarker that takes in a cell that will be passed from the event listener.
6. Inside each event listener, call renderMarker and pass the current cell to it.
7. Inside renderMarker, if the marker is 'X', set the cell content to 'O' and reassign marker to 'O'. Do the opposite if the marker is 'O'.