REST Reminders

Just a quick post today, but this one unfortunately sidetracked me for a bit. Just remember a couple of things: Always ensure that when providing objects as body of a POST request, that you use JSON.stringify to properly encode them. A GET request using fetch cannot have body content associated with it. The body content in JSON is best used with POST or PATCH requests. My dilemma was that I had copied one fetch request, which was a POST request and started using it as a GET without removing the declaration of the body content....

Using JSON With Localstorage

Remember that JSON has to be formatted before it can be saved and properly parsed when retrieved. These gotchas can hurt if you are working with JavaScript objects and are expecting them to be native objects from the start. When saving JSON data to storage, make sure that you are calling the JSON.stringify() method on your object either before or during the localStorage.setItem('key', value) call. What this ensures is that the value will be a properly formatted JSON string and will retain its relationship data and values....

Be Careful With Env Files

Oh they are soo nice to work with aren’t they? Until you realize that you accidentally uploaded one to your public repository. That’s what I accidentally did today. Fortunately, I caught it early on so that I didn’t have any issues with my database that I’m using. I have learned from this that I really need to think ahead with dealing with environment variables. Simply placing them in as an afterthought or during prototyping is not a great idea....

react-youtube

I just wanted to post a quick article on this new dependency I found recently. The react-youtube module is very useful for getting an embedded YouTube video inside your applications. I found the installation and configuration of the module to be very easy. It’s also important to note that this module will work with the YouTube IFrame Player API and has links to the documentation for configuration. I have implemented a copy of this module inside my latest project react-OST where I am using the player for embedding soundtrack videos that have been uploaded....

HTTP/2

Designed to make webpages and applications load resources much faster and reducing the number of connections. Better performance in the transport layer of the browser’s stack of webpage processing. Enables multiplexing requests and responses for quicker concurrent transfer of data. Adds support for prioritization of requests and server push commands. Additional features such as: New flow control Error handling Mechanisms for upgrading HTTP/2 is built on-top of the existing standards....