Securing your web server is always a very important task since you normally don’t want any unauthorized users accessing your server. This tutorial should help you to set up Auth0 together with a Go web server using a JWT middleware for authorization.

Image for post
Image for post
Photo by Adli Wahid on Unsplash
  • Create an Application in Auth0
  • Create the Go Web Server with JWT Authorization
  • Create a valid JWT Access Token

Create an Application in Auth0

First of all, of course, you don’t have to use Auth0 and can simply implement all the user management and signing stuff yourself. …


A brief introduction of how to read and write CSV files in Go.

Image for post
Image for post
Photo by Aaron Burden at Unsplash

Reading and writing CSV files is a pretty common use case in programming. Also, it is pretty easy to understand and implement due to the straightforward format of CSV files.

The Code

As always I prepared a small GitHub repository for you where you can check out the full code:

So let’s first start with defining some basic structures. In the next code snippet, you can see that a small helper method was implemented that only logs an error if available. This helper is called in the actual implementation…


Setting up a Go web server by using Go Fiber with auto-generated Swagger documentation explained step-by-step.

Image for post
Image for post
Photo by Scott Graham on Unsplash

As always you can check out the full example of this article in one of my GitHub repositories, so feel free to take it as a reference:

Setting Up The Web Server From Scratch

So let’s start our Go project from scratch. First, we have to create a new module:

// Create new project folder and 'cd' into it.
$ mkdir medium_go_fiber_swagger && cd medium_go_fiber_swagger
// Create module called `medium_go_fiber_swagger`
$ go mod init medium_go_fiber_swagger

Next, we can already add the Fiber module to our module/application.

// Install Go Fiber module and add to `go.mod`
$ go get -u github.com/gofiber/fiber/v2

The go.mod file should now look like…


Just imagine having a working Docker image with just~30KB of actual base image size, so you approximately don’t have any overhead at all. Let’s make it happen in this article.

Image for post
Image for post
Photo by Wolfgang Hasselmann on Unsplash

How far can we go?

So you might question if it is really possible to have your application run on a 30KB base image. Long story short: “Yes it is!”, even though there is of course also a drawback.

So let’s check some final results first. In the following image, you can see three different Docker images. All three images contain the same runnable Go application, a simple Hello-World program, nothing fancy.


A short introduction to installing Go on your system and creating your very first “Hello-World”-application in Go in under 10 minutes.

Image for post
Image for post
Photo by lucas Favre on Unsplash

1. Installation

Visit https://golang.org/doc/install and download the appropriate installer.


Why it’s super important to understand how JavaScript handles parameters and that it’s not purely Call-by-Reference or Call-by-Value.

Image for post
Image for post
Photo by Sincerely Media on Unsplash

You might know that other languages like C are using pointer arithmetic. So when using variables you can either “point” to a certain address in memory where the actual value of your variable is located (by reference) or have the value directly at hand (by value). Of course, deep under the hood, everything is stored in memory.

In JavaScript, it’s a bit different. …


Securing your Cloud Run services from the public but allowing authenticated developers/users to access them.

Image for post
Image for post
Photo by Markus Spiske on Unsplash

The Issue

When creating a Cloud Run service it’s possible to either set “unauthenticated” access — so it's available to the public internet — or to restrict the access. In most use cases the access should be restricted due to security reasons, especially for backend services. But you can also host your frontends on Cloud Run and here public access is desired, so everyone can use your app.

In one of my other articles — Easy Serverless Deployment Of Your React App Using Cloud Run — you…


A quick and easy way to measure the performance of your method in JavaScript and TypeScript.

Image for post
Image for post
Photo by Dawid Małecki on Unsplash

Performance Measurement in JavaScript

Measuring the performance of a certain method in JavaScript or any other language is actually pretty simple and generally can be split up into 4 parts.

  • Get the current time = Start time
  • Run the method code
  • Get the current time = End time
  • Subtract the end time from the start time = Run duration of your method

So what you would do in your JavaScript is shown in the next snippet:

But you can imagine that adding this code all the time is quite a lot of boilerplate and a lot you have to duplicate each time you…


Deploying your React App as a Docker container on a serverless environment using GCP Cloud Run and making it accessible on the public internet.

Image for post
Image for post
Photo by Brett Jordan on Unsplash

Requirement

Before we start please make sure that you have the following parts ready:

  • A Google Cloud Platform account with enabled billing for your (demo) project
  • Cloud Build is enabled on your GCP project
  • Cloud Run is enabled on your GCP project
  • GCloud SDK is installed on your local machine

Besides these requirements for GCP we of course, also need a containerized React App we want to host. If you don’t have one already please refer to…


How to build and run a lean Docker image for your React web application and why it is important.

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

The “Problem”

I think we all can agree that a big Docker image size is never good. There are several reasons:

  • Increased startup time, especially a problem with automatic scaling
  • Increased costs when e.g. using a cloud provider
  • Longer image pulling time
  • Uses unnecessary storage

With one of my recent articles Decreasing your Node.js Docker image size by 90%! I already provided an example of how to decrease your Docker Image size from around 930MB to just 102MB for your Node.js application. …

Pascal Zwikirsch

Development Team Lead | Passionate Developer

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