Categoryfront-end

Shell Script and Docker

Here is a simple shell script that checks to see if docker is installed. If docker is installed it then filters to see if a container with a certain name is also running and  if it is not it will trigger the run command.

Good tutorial on shell scripting,

Make an API Request Before Bootstrapping Angular Application

In a recent headless angular application, we needed to make an api request before the application was bootstrapped. Below is a code sample of how it was achieved. This code was placed before the closing <body> tags of an index.html file.

 

$http POST preflight error with CORS

Preflighted error while using the $http.post() method. The $http service  uses the browsers XMLHttpRequest object.  Angular defaults the $http.post method to use content type of ‘application/json. Based on this documentation this default content type would trigger a preflighted request while using CORS.

It uses methods other than GET, HEAD or POST.  Also, if POST is used to send request data with a Content-Type other than application/x-www-form-urlencoded, multipart/form-data, or text/plain.

© 2017 Aldo Lugo

Theme by Anders NorenUp ↑