Setting up Docker with a Node app

Long time no post! Today I went through the torturous exercise of trying to set up my app with Docker. The most difficult aspect of this was trying to get my app to access my SQL DB. I can’t guarantee this is the best way, but the TL;DR of it is:

  1. Create and validate docker-compose.yml and .dockerfile files
  2. Add files to project and push project to Github
  3. Install docker, docker-compose, and git on your Amazon EC instance
  4. Pull code from Github to Amazon EC2
  5. Update security groups on EC2
  6. Build your app using docker-compose.yml
  7. Seed your data and verify your app
Read More

Setting up the SERN stack

I’m currently working on building React apps without create-react-app. This post is about setting up the enviornment with respect to the SERN (SQL, Express, React, Node) stack.

Read More

React Gotchas

These are some of the mistakes I found myself making more than once while building my first React app. If I write them down I’m less likely to make them again :)

Read More

I bombed today's self assessment

I told myself coming in that whatever the requirements were, I needed to be very cautious about misinterpreting them. Recall from my previous post I had made an incorrect assumption about a problem statement. This time I somehow overthought it, thinking the request might intentionally be for something unintuitive, and misinterpreted again.

Read More

Solving a closure problem

Last week we had a question on closures. I think I got the answer mostly right because I had previously seen code for memoize()and knew it’d apply, but not because I actually understood each line of code itself.

Read More

Changing object references

Consider the example below. It would be intuitive to think that when we change the value of obj.inner, example is affected. However this is not the case.

var obj = { 
  inner: { x: 10 }
};
var example = obj.inner;
obj.inner   = undefined;

What’s happening here:

  1. An object is defined with key ‘inner’, which points to another object, { x:10 }
  2. var example points to the object that is pointed to by obj.inner Note: this does NOT mean there now exists a relationship/binding between example and obj.inner
  3. The value of obj.inner is changed to undefined Note: the previous object that obj.inner pointed to ({ x:10 }) still exists, and example remains pointing to it
  4. The value of example is then { x: 10 }, not undefined
Read More

Iterators

An iterator is a function applied to each element of a collection as we iterate the collection.

Read More