How to easily provision an EC2 Instance and execute remote commands to install Jenkins

Image for post
Image for post
Photo by Lance Anderson on Unsplash

Intro

Terraform is a tool that allows you to quickly build and provision your Infrastructure as Code and is compatible with many providers such as AWS, Google Cloud, Digital Ocean, and more.

In this article, I will walk you through how we can easily and quickly leverage Terraform to provision an EC2 instance on AWS running Ubuntu and install Jenkins.

Prerequisites


How to create a custom date scalar in Apollo GraphQL

Image for post
Image for post
Photo by Ryan Moulton on Unsplash

Intro

Out of the box, GraphQL offers us some default scalar types to work with. These include Int, Float, String, Boolean, and ID. In most cases, these are enough for us to work with to build out most applications.

There may come a time where you want to work with custom scalars — for example, working with dates. For most projects, you could get away with storing date values as a String. But if you would like to make your application a little more robust, you can implement a custom date scalar. …


Simplify your code by using an error handling middleware

Image for post
Image for post
Photo by Samantha Gades on Unsplash

Due to the unopinionated nature of JavaScript, there are many ways to accomplish a single task. This can be a double edge sword, especially when working in a larger team setting. This is where processes and guidelines come into play. In this article I’m going to show you how my team does error handling in an Express.js application using an error handling middleware.

Prerequisites

  • Node.js installed on your machine
  • Knowledge of Node.js and Express.js
  • Knowledge of how middleware works in Express.js

Project Setup

Let’s create a basic Express.js application with one endpoint. The endpoint is a POST method that takes two input parameters, title and author. …


How to quickly build and deploy a serverless API to AWS

Image for post
Image for post
Photo by Hassan Pasha on Unsplash

Intro

“Pick the right tool for the job” — You’ve probably heard this term before. If your goal is to quickly build a serverless API, maybe for a prototype or some sort, look no further than Claudia.js. With just a few lines of code, you can deploy your project to AWS Lambda and API Gateway. In this article, I’m going to show you how to accomplish that.

Description from Claudia.js themselves:

Claudia makes it easy to deploy Node.js projects to AWS Lambda and API Gateway. It automates all the error-prone deployment and configuration tasks, and sets everything up the way JavaScript developers expect out of the box. …


Easily boost the performance of your application with Redis

Image for post
Image for post
Photo by chuttersnap on Unsplash

Introduction

We all know retrieving data from memory is wicked fast — a lot faster than retrieving data from disk. This is exactly what Redis allows us to do. It allows us to cache data in memory and use it as a datastore.

If you are unfamiliar with Redis, I highly recommend doing some research and giving their documentation a look. There are tons of well written articles diving into Redis.

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes with radius queries and streams. …


Image for post
Image for post
Photo by Nadine Shaabana on Unsplash

Introduction

In this article, I am going to cover my 5 most used JavaScript array methods in my career as a full web stack developer. Please note that my 5 may be different from others. I am sharing from my own experiences and for fun.

For a full list of methods on the array prototype, check out the MDN web docs on arrays:

1. Array.prototype.map()

I’m going out on a limb and say map() is one of the most commonly used method on the array prototype. …


The easy way to implement authentication and authorization in GraphQL

Image for post
Image for post
Photo by Dominik Schröder on Unsplash

Intro

There is a saying that “GraphQL doesn’t care how authentication or authorization is implemented”. This can cause a lot of confusion because there are many ways you can handle it.

In this tutorial, I’m going to show you how to implement authentication and authorization in GraphQL the easy way — by authenticating users when building the context object and implementing authorization on the resolvers.

The context object is one that gets passed down to every resolver. This makes it the logical place to perform authentication. Let’s get started!

Project Setup

I have provided starter code so we can focus on implementing the authentication piece and skip setting up the GraphQL server. …


How to build and deploy a GraphQL API to AWS with Serverless in minutes

Image for post
Image for post
Photo by Daniel Abadia on Unsplash

Intro

Function-as-a-Service (FaaS) has become very popular over the last few years due so it’s simplicity. With just a few lines of code, we can have an application up and running without having to worry about infrastructure. You also only pay for the resources you consume, which can keep costs down. This makes FaaS a perfect candidate for any function you may only need to run periodically for a short amount of time. For example, we utilize it to generate sales reports every morning at my company.

In this article I’m going to show you how you can quickly build a GraphQL API with Serverless and deploy to AWS. …


Track the price of Bitcon, Ethereum, LiteCoin, and other cryptocurrencies!

Image for post
Image for post
Photo by Austin Distel on Unsplash

Introduction

With over 45,000 stars on Github and over 300,000 npm weekly downloads, Next.js is currently one of the hottest React framework in the space. It offers server-side rending right out of the box, is optimized for speed, and is relatively quick and easy to get up and running. I won’t dive into all the benefits of Next.js right now so we can focus on building our cryptocurrency tracking application!

What we are building

In this article, we are going to be building a cryptocurrency tracking application with Next.js and Apollo GraphQL. The application will display the prices of the top 30 cryptocurrencies by fetching data from Nomics API on a polling interval. …


Image for post
Image for post
Image Credit: Apollo

Introduction

Since being publicly released in 2015, GraphQL has been climbing in popularity and chosen as an alternative to the tried-and-true REST API. Here are a few reasons why I love using GraphQL myself:

  1. Validation and type checking out-of-the-box
  2. Queries are basically self documenting
  3. Retrieve only the data you need so you’re not over-fetching
  4. Single endpoint for all your queries
  5. Provides detailed error messages

There are tons of well written articles discussing the benefits of using GraphQL if you want to learn more. I would also highly recommend doing a deep dive into GraphQL’s documentation if you are new to GraphQL.

In this article, I will show you how to build a searchable query in Apollo GraphQL. …

About

Kevin Luu

Full Stack Developer, Javascript Enthusiast, Mentor

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