This post is a follow up to Hosting a Single Page Application in AWS. It builds on that article with some specifics for the Single SPA micro frontend famework. There are couple core problems to solve here when using the recommended setup outside of just hosting the applicaiton as described in the article linked above.… Continue reading Deploying a Single SPA Application on AWS
Category: JavaScript
Give Modals, Drawers, and other Overlay Elements URLs with React Router
One of my pet peeves about webapps is that actions that happen in things like a modal or other popover are often not linkable. This makes sharing those actions with others hard: send a link to the original URL along with instructions about what to do in order to trigger the overlay. A much better… Continue reading Give Modals, Drawers, and other Overlay Elements URLs with React Router
Inversion of Control is About Choice
Specifically inversion of control is about not making a choice in one place and forcing that choice to be made elsewhere. Take a library that talks to a database. Should that library make a choice on how to connect to the datatabase? If it does, that's a huge set of things to support and more… Continue reading Inversion of Control is About Choice
What is Self in a Service Worker?
After researching service workers a bit, none of the tutorials seem to explicitly state what self actuall is. It's a ServiceWorkerGlobalScope implementation. The events passed to the install and activate listeners are ExtenableEvent implementations. This is where the waitUntil method comes from to force an event listener to wait until a promise resolves. The install… Continue reading What is Self in a Service Worker?
Handling Authentication Tokens in Single Page Apps
There are broad scenarios in which a single page app (SPA) needs to handle authentication: The SPA is using an API custom built for the app itself -- the API being used is not public in any other way The SPA is using an API built for public consumption -- one with a full fledged… Continue reading Handling Authentication Tokens in Single Page Apps
Assertion Error Diffs with Karma, Mocha, and Chai
Promises are Not for Control Flow
Common advice in languages with exceptions is that exceptions are not for control flow. A rejected promise is not any different than a thrown exception: in both cases something when exceptionally wrong and must be dealt with. This week I was fighting with promises while building a slack app because I was attempting to use… Continue reading Promises are Not for Control Flow
Beautiful Imports in NodeJS
One of the things I enjoy about ECMAScript modules is their ease on the eyes. They look good -- the same way Python's import statement can look nice. It's also nice to have to explicitly import the things necessary for a file/module to its work. Need the whole module? That's a choice that has to… Continue reading Beautiful Imports in NodeJS
Building an Upload System Backed by S3 and Client-Side Uploads
One of the things I try to do when building applications is keep servers stateless. This makes those servers easy to throw away -- a piece of infrastructure failing (which it always will) is not a big deal with stateless servers. Just spin up a new one. When the requirement came down the pipeline to… Continue reading Building an Upload System Backed by S3 and Client-Side Uploads
How to Monitor Client-Side Upload Progress (with XMLHttpRequest)
Showing a user something like a progress bar during a file upload is handy and let's them know that stuff is working. Higher level abstractions like fetch don't really provide a look into how much of a request body has been sent, but good ol' XMLHttpRequest does. In order to monitor upload progress, attach an… Continue reading How to Monitor Client-Side Upload Progress (with XMLHttpRequest)