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

Manage Cross-Origin Resource Sharing In A Node With Hapi Application

To continue down my path of solving the worlds cross-origin resource sharing (CORS) problems, I wanted to adventure into Hapi, a Node.js framework that I’ve been heavily using lately. If you’re not familiar with cross-origin resource sharing, it is something that frequently comes up when you try to use front-end JavaScript to access content from another host or port.

Previously I had written about exploring CORS in an Express with Node.js application. While Express is probably the most popular framework, it certainly isn’t the only framework, which is why we’re going to take a look at CORS in Hapi.

Read More

Handling CORS Related Issues In An Express Framework Node.js Web Application

Proper cross-origin resource sharing (CORS) configuration is one of those things that is completely necessary when building a RESTful API, but also one of those things that is a total pain in the butt when it comes to prototyping an application. CORS related errors are common when testing a web application where the front-end JavaScript layer exists on a different port or host than the API that it tries to access.

Previously I had written about configuring cross-origin resource sharing via a Golang RESTful API, but this time we’re going to explore the same using Node.js and Express Framework.

Read More

Handling CORS In A Golang Web Application

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 More

Make HTTP Requests In Android And iOS With Ionic Framework

As a modern developer, at some point in time you’re going to find yourself needing to work with a RESTful API. You’re going to need to make HTTP requests to get data into your app or even change data on a remote database.

Lucky for us, making HTTP requests with Ionic Framework is a heck of a lot easier than making them with native code.

The following will show you how to make GET requests for JSON data at some fictional API endpoint. It is for Ionic Framework 1. If you’re looking for how to make HTTP requests using Ionic 2, check here.

Read More

Bypass CORS Errors When Testing APIs Locally

Anyone who has worked with a RESTful API using JavaScript knows that testing can be a complete pain if the API owner hasn’t enabled CORS on their server. So what is CORS? According to Wikipedia, it is the following:

Cross-origin resource sharing (CORS) is a mechanism that allows many resources (e.g., fonts, JavaScript, etc.) on a web page to be requested from another domain outside the domain the resource originated from.

Often API owners will leave CORS disabled even though their API is open to the public. In my opinion it doesn’t feel public if the API owner is not allowing requests from all angles.

Here are a few tricks I’ve picked up in regards to bypassing the awful CORS errors you receive in your browser when testing.

Read More


Follow Us

Support This Site