If you’re looking to take a project with a Ruby on Rails API backend & React frontend into production, look no further. Over the past few weeks I’ve been working to deploy a number of my projects onto the Heroku platform. Here I’ll outline the steps needed to move a simple application from the development stage to production stage.

When picking a platform to host my projects online Heroku seemed like the obvious choice. It had been recommended to me due to its ease of use and how quickly it could be up and running. So first things first, you’re…

Part 3

In the final part of my Authentication in Node series I’m going to add three last pieces of functionality to my backend Node server.

First will be what I’m calling a ‘grab user’ function, which essential will run every time the frontend gets reloaded, refreshed or redirected to take the stored token cookie and make sure that it’s still valid.

The second will be the main ‘is-auth’ function that will authenticate the user on every other route/request that requires a user to be logged in to access the db, request data, etc. …

Adding Validation (Part 2)

This is a continuation on the piece I wrote about adding Authentication into a Node project using HTTP cookies, BCrypt and JWT tokens. Previously, I had set up my application to accept an incoming request where a user was signing up. I then took that info, hashed the password, saved the input data in my database and then returned a signed token which would be stored on the client side as an HTTP cookie. …

Part 1

So, you’ve decided to finally broach the topic of authentication within your Node application. Come to find out there are of course a ton of ways to implement Auth within Node, so where do you start? First choice is to decide whether you want to just let a third party service handle it for you, or whether you’re brave enough to carry through and implement it on your own! If the second choice is for you, well then you’ve come to right place. …

In my never ending journey of refactoring and refining my code my most recent endeavor has been in writing cleaner and easier to read code with the help of async-await

Up until recently I had only used JavaScript & Promises primarily within the context of writing React code. As far as asynchronous code and Promises go, the only use-cases I had for them were in writing fetch() calls to an API. It would usually look something like this:

function getUsers(){
.then(resp => resp.json()
.then(data => someFunctionToUseReturnedData(data))
.catch(err => console.log(err))

Anyone familiar with the code above knows that JavaScript’s…

In my last post I did a short walk through of refactoring existing Redux code to utilize the Redux Toolkit and React-Redux Hooks. That article can be found (here) and seeing as I will be adding on to the demo started there it may be a good place to start. Now, two additional bits of Redux Toolkit functionality I wanted to touch on deal with directly mutating state within our slice (thanks to Immer) and then also making asynchronous HTTP calls (thanks to Thunk). …

During this year’s Reactathon one of the coolest presentation I had to chance to catch was with Mark Erickson. He was there to present some modern Redux techniques and specifically the React Toolkit and the use of the ever popular *hooks*. It inspired me to go back and refactor some of my old Redux code from using the ‘connect’ higher order component to using the Toolkit. So if you’re looking to refactor Redux to make use of it’s hooks I’m gonna walk through a simple refactor and implementation of Redux Toolkit.

First things first I’ll start with a basic React…

When learning about React for the first time one of the very first decisions you’re faced with is which way to write your components. React gives you two different variants for this choice: Class Components & Functional components. Initially when I was trying to wrap my head around this and learn why to use one and not the other I figured a good rule of thumb was to always base my decision off whether or not my component would need to make use of state. If it did then it had to be a Class component, if not then a…

Upon my own personal journey to learn and become familiar with JavaScript I’ve found probably the Most helpful tool in refining my code is without a doubt Google Chrome’s DevTools.

Anyone who has “inspected” a webpage probably has some understanding of how truly powerful the DevTools are. They include a very helpful visualization of the DOM tree, a REPL console in which you can run JavaScript, a CSS reference where you can manipulate elements style responsively, and a Network reference where you can delve into the load time/order/etc. of any webpage just to name a few. …

Since Rails 5.1 theres a new form in town and it goes by the name of ‘form_with’.

The Predecessors: <form_for> & <form_tag>

Those familiar with Ruby on Rails know that the two main Form Helpers that Rails provides out of the box are <form_tag> and <form_for>. Say for example you have an Article model that you would like the user to be able to create another instance of:

Brian Lego

Software Engineer based in NYC

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store