Parse XML Data In A Golang Application

March 13, 2017 Nic Raboy

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.

Read More

JWT Authentication In A Node.js Powered API

March 10, 2017 Nic Raboy

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.

Read More

JavaScript Libraries In A TypeScript Application, Revisited

March 6, 2017 Nic Raboy

If you haven’t already gotten involved with it, you’ll probably know that TypeScript is becoming increasingly popular. Being able to use a superset of JavaScript in a typed language that compiles down to JavaScript is a great thing. However, if you’ve ever played around with TypeScript and tried to use JavaScript libraries, you’ll probably know that sometimes it can be a real pain. Often JavaScript libraries do not ship with type definitions which are critical when it comes to playing nice with TypeScript.

If you’ve been keeping up with The Polyglot Developer you’ll probably remember two posts that were created. Previously I had written about including external JavaScript libraries in an Angular application as well as adding type definitions to external JavaScript libraries in TypeScript.

We’re going to revisit these two articles and explore all the ways to include JavaScript libraries in TypeScript applications. These include applications built with NativeScript, Ionic, and Angular.

Read More

Upload Files To A Minio Object Storage Cloud With Node.js And Multer

March 5, 2017 Nic Raboy

The recent Amazon S3 outage that took down much of the internet inspired me to talk about alternatives. Not too long ago I wrote about an open source object storage software called Minio and how I was using it on my Raspberry Pi for backups. The great thing about Minio is it shares the same APIs as AWS S3, but can be deployed to your own hardware, eliminating Amazon as a dependency.

This time around I thought it would be great to share how to use Minio as an object storage for a Node.js application that uses the middleware, Multer, for handling file uploads.

Read More

Connecting To A Detached Docker Container For Terminal Interaction

March 4, 2017 Nic Raboy

When I use Docker, most of the time I start my containers in detached mode, meaning that the container will deploy in the background without any further interaction from myself. However, every once in a while I find myself needing to connect to the container to view log information.

So how do you connect to a detached container that is already running? We’re going to take a look at how to do this with minimal effort.

Read More

Track The Device Geolocation In A NativeScript Angular Mobile Application

March 3, 2017 Nic Raboy

I get a particular set of questions quite a bit on my blog and other social media outlets. One of these questions includes how to use geolocation features such as GPS tracking within a NativeScript mobile application for iOS and Android. Many people want to be able to gather location information and in many cases use this information for mapping.

So what does it take to make use of the device GPS hardware for location tracking?

We’re going to see how to create a mobile application for Android and iOS using NativeScript and Angular that makes use of geolocation in a few different ways.

Read More

Use A Side Drawer And Feature Rich List View In A NativeScript Angular App

March 2, 2017 Nic Raboy

I release a lot of content and build a lot of mobile applications using the NativeScript mobile framework, most of which includes Angular. Lately I’ve been getting many requests for information on using a side drawer within the application. These side drawer components can improve the user experience significantly so I figured I would explore the topic.

We’re going to see how to include a side drawer in our NativeScript Android and iOS application, built with Angular. To take things to the next level, we’re also going to include a feature rich list view as our core content.

Read More