How To Send HTML Email in Node.js

If you reading this to learn how to send the beautiful HTML email you just finished designing, you’ve already done the hard part. While designing HTML email is a pain, sending HTML email may required an additional step or two than what you’re used to but it’s still super easy.

Read more »

Gzip Page Assets With Nginx

This is something I feel like I should have known, but didn’t. By default, Nginx only applies gzip compression to text/html MIME-types. This means any additional assets like css, js, fonts etc. are not compressed.

Read more »

Mailtrap.io - A Dummy SMTP Server So You Don't Embarrass Yourself

If you have a program/application which sends email you should really take a look at Mailtrap.io. Mailtrap provides a fake SMTP server to which you can send email during testing/development and a reasonable pricing model that includes a free plan. I love it.

Read more »

Building A Class Curriculum Is Hard!

I had an opportunity to teach a Computer Science class at our local community college for this upcoming fall semester and was allowed to choose a topic/language and develop my own curriculum. Teaching has always been something I’m interested in so I was really looking forward to this experience. After spending a good bit of time this summer developing curriculum, I have to admit that having never done it before it’s been harder than I expected (but still fun!). Unfortunately, after several weeks of planning and with about 1 week left before the start of the semester the class ended up being canceled. That was certainly a big disappointment, but there is a chance that class will run again next semester. I wanted to share my thought process as well as the general outline of the class topics, and would appreciate any feedback from readers.

Read more »

Allow Public Access To Private Files In An AWS S3 Bucket

For security purposes you may not want objects stored in your AWS S3 buckets to be publicly accessible (and by default, all objects in S3 are private). However, you likely still need to be able to serve them to properly authenticated users. This can be done by utilizing pre-signed URLs.

Read more »

Create CSV Files With Node.js

More often than I care for I find myself needing to write data to a csv file. This certainly falls under the “less than interesting” category of things I work on, but you have to take the good with the bad, I guess.

Read more »

Dynamic 'Where' Clauses With Parameterized Queries in Node.js and MySQL

Occassionally when writing SQL queries the number of fields that we need to filter on may change depending on user selection. Let’s take a look at how we can build dynamic ‘where’ clauses and the corresponding parameter array to handle this scenario.

Read more »

Test JWT-Authenticated Express Routes with Jest And SuperTest

So you have decided to use JSON Web Tokens (JWT) to secure your API, or you are already using JWT and need to add some unit tests for your routes, and you are a little unsure how to acquire, store, and pass the required token to complete the test. Let’s take a look at how to do this using Jest and SuperTest.

Read more »

Need To Allow Public Access To Localhost? Check Out Ngrok

During the development process there may be times when you need to allow public access to your local development environment. You may want to demo your progress to a client or test an incoming webhook, for example. With ngrok (https://ngrok.com) there is no need to push to production or some other public facing environment in order to accomplish this.

Read more »

Force File Download From Amazon S3 With Node/Express

Generally, when content is returned from a web server to a browser it is intended to be displayed inline, meaning rendered as a web page or as part of a web page. This is especially true for file types such as images, html documents, PDF documents, etc. that can be rendered natively by web browsers. There are times, however, when we would rather have the user be prompted to download and save the file locally. Here is a quick look at how we can send files from S3 (or other remote locations) to be downloaded and saved locally on the client.

Read more »

Maintain Environment Configuration Settings and Secrets in Node.js Apps

It worth it to invest some time reaching a good solution for managing environment configuration settings and secrets for your apps to support multiple runtime environments (development, production, staging, etc) and multiple developers. These settings will likely require different configurations, depending on environment and/or developer, for things such as database connection information, log settings, API keys, usernames, passwords, etc. Additionally, we need to keep some of this information from being included in the codebase or repository but still be easily maintained. Let’s look at 2 packages that when used together create a nice solution to this problem.

Read more »

How To Upload Files With React To A Node/Express Server

Handling file uploads in a React/Node/Express application is done a little different on both the server-side and client-side than what you may be used to doing when handling regular form submissions. In this post we’ll take a look at code on the server and client for uploading a file from a React application and saving the file on the server using Node.js and Express.

Read more »

How To Add Sass Support to a Create-React-App Project (after ejecting)

I spent far too much time when I was first getting into React development trying to maintain my own boilerplate for new projects. Even though I don’t use any of that old boilerplate code anymore, it wasn’t time completely wasted as I learned a good deal about the React ecosystem, especially webpack. But eventually the process became too tedious and, frankly, I wasn’t doing anywhere near as good a job as what others had already done. So now I start every new project with create-react-app (https://github.com/facebookincubator/create-react-app). It’s an incredible tool but it doesn’t include support for Sass, which I often use. So I must add that to the configuration and build process manually.

Read more »

How To Install The Latest Version of Node.js on Ubuntu

Here is a quick and easy way to install the latest version of Node.js on an Ubuntu system. As with many things in the JavaScript world there is more than one way to do this, but for getting up-and-going quickly it’s hard to beat n.

Read more »

Display A 'Loading' Indicator In React During Ajax Requests

It’s good UX to provide visual feedback to the user of web applications when an asynchronous operation is taking place. We’ve all seen these ‘loading’ indicators in the form of spinning icons, overlays, modals, etc. as we wait for view data to load. Here is a quick look at how we can implement a ‘loading’ indicator when using React.

Read more »

Considerations When Choosing An NPM Package

NPM, the package manager for the JavaScript programming language, has become the largest package registry in the world with more than double the number of packages of the next largest registry. This doesn’t happen by accident. JavaScript is an incredibly popular programming language and NPM makes it easy for any JavaScript developer to publish his/her own packages. With such a large number of packages there is a high probability that we can find an existing solution to almost anything we need as developers. And in many cases we can find multiple packages to solve the same problem. When this happens here are some things I look at to help make a selection on what package to use.

Read more »

Submitting Form Data With React

I was reading through a thread on Reddit recently with some users discussing React. One particular user seemed a little frustrated with his/her understanding of React and had a few specific complaints about form data and submissions. I decided to put together an example addressing each of the issues (s)he is having.

Read more »

Custom Form Validation Example With React and Bootstrap

As I first started to work with React and familiarize myself with it’s one-way data bindings I found that I must re-think some of the ways I’ve solved seemingly trivial problems before. One such issue is dealing with custom client-side form validation. There are no shortages of ways and opinions on how to do this, and numerous packages exists to solve this very problem (with, IMHO varying degrees of success). However, as I head down the path of learning something new I don’t mind reinventing the wheel as it often helps the learning process.

Read more »

Why I Left ColdFusion

I recently observed a Twitter discussion with some former (and soon to be former) ColdFusion developers, most notably Raymond Camden (@RaymondCamden), Adam Cameron (@DAC_dev), and Todd Rafferty (@webRat), regarding their decision to move on from ColdFusion as their primary web development platform. Adam decided to come up with a list of questions for current and former CF developers to gather their thoughts on this topic. As a former ColdFusion developer who has moved on to Node.js, I thought I would add my $0.02. Adam’s blog post regarding the survey can be found here. My responses are as follows:

Read more »

Search and Split PDF Files With Node.js

So much of my work is web development related that when something different comes along I can geek out on it pretty hard. It’s even better when it’s an opportunity to save our organization money. A recent need for a command line script to search and split a PDF file satisfied both.

Read more »

Performing 'like' Queries Using the MySQL Package in Node.js

The MySQL package is a hugely popular library for working with MySQL from Node.js, and with good reason. It’s performant, easy to use, battle tested, and well documented. I was a bit surprised, however, that the documentation doesn’t show the syntax for performing parameterized ‘like’ queries.

Read more »

A Dynamic Catch-All Route Handler For Rendering Views in Express.js

I was recently working on a demo project and found myself constantly creating and deleting views. Rather than having to keep updating my routes I wondered if I could create a dynamic route handler that would match a view with a requested route.

Read more »