Authenticate A Golang API With JSON Web Tokens

Over the past few weeks I've been doing a lot of investigation into JSON Web Tokens (JWT) for authentication in APIs.  If you've been keeping up, you'll remember I wrote about JWT authentication in a Node.js application as well as building a client facing NativeScript and Angular mobile application that made use of the Node.js backend.  This is great, but what if you're not very fond of JavaScript development?

We're going to see how to create a backend API that creates and validates JSON Web Tokens using the Go programming language.  This teach us how to create an API that offers an authentication mechanism outside of sessions and cookies, which typically are not available when working with an API.

TPDP Episode #13: The Go Programming Language And Modern Development

I am pleased to announce that the latest episode of The Polyglot Developer Podcast has been published to all the popular podcasting networks which include, but are not limited to, iTunes and Pocket Casts.  In this episode titled, The Go Programming Language and Where it Fits in Modern Development, I am joined by Go advocate, Matt Holt, where we discuss Go as an option to modern development.

In this episode we discuss where Go excels and how it compares to other popular development technologies such as PHP and Node.js.


Parse CSV Data Using The Go Programming Language

Ever found yourself working with comma separated value (CSV) data from a file or other source?  This format is easy to generate if you’re working with spreadsheet applications like Google Sheets or Microsoft Excel, and RDBMS applications.  So how do we load this data and work with it in an application?  More specifically an application built with the Go programming language?

We’re going to see how to take a CSV file and load it into a custom data structure to eventually be printed as JSON within the application.


Animate HTML Components In An Angular Application

When building a web application, not only do you need amazing features, but you also need a stunning user experience and that can often be managed by making good use of UI components.  When I’m using my favorite web applications, the way components are displayed on the screen are sometimes what makes the application so memorable.  Designers will often animate components to make them stand out.

When building a web application you can use CSS keyframe animations, but if you’re using Angular, there is another way.  We’re going to see how to use the Angular Animations component to animate UI components on the screen.


Authenticate With JWT In A NativeScript Angular Mobile Application

Any mobile application that accesses remote data will need authentication at some point in time.  There are many different authentication strategies out there, one of which is with Json Web Tokens (JWT) that we explored in one of my previous Node.js articles.  With JWT, users can authenticate via username and password, receive a signed token back, and use that token for any future API request rather than continuing to distribute the username and password.

In this tutorial we're going to explore how to build an Android and iOS mobile application using NativeScript and Angular that authenticates with an API and then uses a Json Web Token for future requests to that same API.

Build A Custom Docker Image For Your Containerized Web Application

I’ve been working with Docker for a while now and I’ve found that I’m rarely using one of the vanilla images found on Docker Hub.  By rarely, I don’t mean never, but in most cases I find that I’m building my own custom Docker image for any web application that I wish to containerize.  This allows me to create an image that meets my needs and deploy it anywhere and anytime that I find necessary.

We’re going to see how to build a simple web application and turn it into a Docker image so it is containerized and easily deployable anywhere that Docker Engine is available.


Bundle HTML, CSS, And JavaScript To Be Served In A Golang Application

So I’ve been working on a project that uses the Go programming language.  The application I’m building is a web application that I plan to distribute.  The thing is, I don’t want to distribute hundreds of files to make it possible.  The application has an API built with Go and the front-end that consumes the API is built with Angular.  This lead me searching for a way to bundle all the files into the final binary.

There are several packages that exist for bundling assets into a Golang application.  Popular packages include go-bindata, go-bindata-assetfs, and go.rice.  I had the most success with go.rice, so we’re going to explore it in this article.


Use NGINX As A Reverse Proxy To Your Containerized Docker Applications

You might have noticed that I’m doing quite a bit of Docker related articles lately.  This is because I’ve been exploring it as an option for the future of my personal web applications.  As of right now I’m serving several web applications on Digital Ocean under a single Apache instance.  As requests come into my server, Apache routes them to the appropriate application via virtual hosts.  Each application is a different directory on the virtual private server (VPS).  If I were to containerize each application, things would behave a bit differently.  I would need to set up a reverse proxy to route each request to a different container on the host.

While Apache can work as a reverse proxy, there are other options that work way better.  For example NGINX is known for being an awesome reverse proxy solution.  We’re going to see how to create several web application containers and route between them with an NGINX reverse proxy container.


Parse XML Data In A Golang Application

While I don’t see a lot of it anymore, XML is still a common data format that people use.  I prefer JSON, but I don’t always have a say in how I receive data.  Some time ago I wrote a few tutorials on which include parsing XML data with Node.js, parsing XML data with Java, and parsing XML data with PHP.  If you’ve been keeping up, I’ve been doing a lot of development with the Go programming language which is why I think it would be a great idea to go over XML in Golang.

Of the various programming languages, I think XML is the easiest to work with in the Go programming language.  We’re going to see how to take XML data and unmarshal it into a custom structure.  We’re also going to see how to take JSON data and convert it into XML.


JWT Authentication In A Node.js Powered API

When it comes to API development, there is often a need to protect certain endpoints or rate-limit the API in general.  Because you are working with endpoints from clients possibly on a different domain, you can't authenticate users with sessions and cookies.  It would also be a bad idea to pass around a username and password with each request.  Typically endpoints are protected with tokens that are passed with each request and these tokens are often JSON Web Tokens (JWT) that work very well.

We're going to see how to create a very simple API using Node.js with protected endpoints that require a valid JWT in order for requests to succeed.