Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Validate Form Submissions In Node.js With Google reCAPTCHA

Anyone that operates a website or web application with a contact page knows how bad the SPAM problem on the internet is. Spammers, phishers, and other malicious people create bots that will crawl search engines for contact forms and send emails to the hosts, register accounts, or something else. There was a point in time that I was receiving more than ten emails a day from spammers that wanted to redesign my website. This kind of activity is incredibly annoying on my inbox.

This is where CAPTCHA and reCAPTCHA form elements come into play. These elements typically require some interaction such as typing words from an image or solving a math problem. Adding this small amount of form complexity can go a long way towards stopping bots.

We’re going to see how to hook up a Google reCAPTCHA element into a client facing form and validate that element using a Node.js backend.

Read More

TPDP Episode #14: Object Storage for Application Developers

I am pleased to announce that the latest episode of The Polyglot Developer Podcast is now available to download from all the popular podcasting networks. In this episode titled, Object Storage for Application Developers, I’m joined by Krishna Srinivas from Minio to talk about what object storage is and the various solutions that are available.

Episode #14 can be downloaded for free from iTunes, Pocket Casts, and every other popular network, but it can also be heard below.

Read More

Add Two-Factor Authentication To A Golang RESTful API

When it comes to authenticating users for making use of your API, it is a good idea to add an extra step beyond standard username and password. This is called two-factor authentication (2FA) and it acts as a second layer of security for users making use of your application.

Not too long ago I had written about adding 2FA to a RESTful API created with Node.js and Express Framework, but what if we wanted to do it in Golang? The logic isn’t any different, just a new syntax for a new language.

We’re going to see how to add two-factor authentication to a Golang API that makes use of Json Web Tokens (JWT).

Read More

Form Validation In An Angular Web Application With Custom Directives

When creating a web application that accepts user input, it is often a good idea to validate anything the user provides. While you should always validate this information via some backend server-side code, it often provides a good user experience to validate via the frontend as well. By doing form validation on the frontend, you set yourself up for the possibility to catch and display errors before form submission.

If you’ve been keeping up, I once demonstrated how to do form validation in AngularJS via an Ionic Framework application. As of now, AngularJS is ancient technology, so we’re going to see how to do the same with Angular. However, we’ll be seeing from the perspective of a web application, rather than a cross-platform hybrid mobile application.

We’re going to be basing everything in this guide off a new project created via the Angular CLI. This means that you should have installed the Angular CLI before going forward.

Read More

Implement 2FA With Time-Based One-Time Passwords In A Node.js API

Not too long ago I wrote about authenticating within a Node.js API using Json Web Tokens (JWT). The basis of the example is around authenticating via a username and password and receiving a JWT for every future request against the API. While that example is incredibly useful and follows best practice, it doesn’t cover the scenario where you’d like to have a two-factor authentication (2FA) option for your users. In case you’re unfamiliar, 2FA is a second layer of protection for accounts made possible by a time-based token generated by a shared secret key.

We’re going to see how to add a two-factor authentication option to our Node.js API while continuing to use Json Web Tokens.

Read More

Build An Image Manager With NativeScript, Node.js, And The Minio Object Storage Cloud

When building a mobile application, there are often scenarios where you need to storage files remotely and when I say files, I don’t mean database data. For example, maybe you want to develop an image manager or photo storage solution like what Facebook and Instagram offer? There are many solutions, for example you could store the files in your database as binary data, or you could store the files on the same server as your web application. However, there are better options, for example, you could use an object storage solution to store files uploaded from your mobile application. Popular object storage solutions include AWS S3 as well as the open source alternative Minio.

We’re going to see how to leverage Minio to store images that have been uploaded from an Android and iOS mobile application built with NativeScript and Angular.

Read More

Creating And Using Custom Pipes In An Angular Web Application

When I’m developing with Angular, I often find myself needing to loop over an object via HTML markup. In AngularJS one could loop over object properties or arrays, but in Angular you can only loop over arrays by default. This is easily fixable through what are known as Angular Pipes.

With pipes you can create display-value transformations for pretty much anything, or in my case transform an object into an array and loop over it. We’re going to see how to create a pipe that will allow us to loop over an object in the HTML layer.

Read More