If you’ve ever spent time building RESTful APIs, you’ve probably come across cross-origin resource sharing (CORS) issues at some time or another. Often clients will receive errors when trying to interact with an API from a domain or port different from the actual API. Back in the day I had written a hacky article on getting past these CORS issues by manipulating the browser settings. However, it is best to tackle these issues at the source.
We’re going to see how to change the cross-origin resource sharing configuration in a Golang web application that uses the mux package.
Read MoreWhen building a modern web application, chances are that you’ll need to consume data from some remote resource, whether it be one that you’ve built or something someone else built. Sending HTTP requests is one of the more popular ways to send data from client facing applications to RESTful API backends.
We’re going to see how to send HTTP requests within a Vue.js web application, using a variety of techniques such as those found in the popular axios and vue-resource libraries.
Read MoreAs you may remember, I recently released The Polyglot Developer 2.0 which was a migration from WordPress to Hugo. Because my WordPress permalinks matched a similar format to Hugo I didn’t have to make too many changes. However, there was an issue with the category
and tag
taxonomies. In Hugo these were recommended to be plural, while in WordPress they were singular.
I’m currently using Apache for hosting The Polyglot Developer so I had to figure out how to redirect the previous WordPress traffic to prevent bad links which would hurt the search engine optimization (SEO) of my blog. We’re going to see how I made such redirects happen.
Read MoreNot too long I wrote about consuming remote API data using Golang. However, as you know, I’m also a heavy Node.js developer as well. So how do we issue HTTP requests from within a Node.js application and why might you want to. The simple answer is that you might want to consume someone else’s data within your web application and you can’t just do that like you would in a browser-based application using Ajax or similar.
We’re going to see how to make HTTP requests possible within Node.js.
Read MoreBack when I was really getting into the swing of Node.js, I had written about creating a simple RESTful API that made use of the Express framework. Express was, and still is, one of the most popular frameworks for creating web applications with Node.js. However, this doesn’t mean it is the best solution.
Recently I’ve been hearing a lot around Hapi for Node.js. The common feedback that I hear is that it is specifically designed for creating RESTful web services making them significantly easier to create without as much boilerplate code.
We’re going to see how to create a simple API using Hapi as well as packages such as Joi for request validation.
Read MoreWhen building an application, regardless if it is mobile, web, or neither, it is a good idea to come up with a collection of tests that can be used in a continuous integration scenario. I must admit, I don’t have the best habits when it comes to writing tests, but I’m sure my applications would be significantly better if I did.
Previously I had written about unit testing in Golang as well as unit testing in NativeScript with Angular. This time around it makes sense to talk about writing tests in Node.js, another technology that I have in my tool belt.
Read MoreI am a huge fan of the Go programming language and have written a decent amount of material on the subject. For example, a popular tutorial I wrote titled, Create a Simple RESTful API with Golang, focuses on developing an API. However, I recently received questions on the subject of consuming data from other APIs from within a Go application.
We’re going to see how to issue HTTP requests from within Go, in an effort to consume or send data to other RESTful APIs that might exist on the internet.
Read More