Monthly Archives: March 2015

Adding a RESTful API on a Unix Domain Socket to a MEAN Stack Application

Why would you want to do this? Well, it provides the ability to expose your API to command line utilities.  For example Docker does this exact same thing for it’s CLI.

Here is an example server API layered on a default MEAN stack scaffold app.js:

Here is an example command-line client, using Node.js, that accesses the above server API:

Finally the results of running the cli:

 

Example of simple responsive layout with Angular Material

Playing with Angular Material lately, and decided to have a look at Responsive Layouts, to have a web page dynamically reorganise itself according to the device viewing it (and its orientation):

So a simple proof-of-concept, here’s some css:

and some html, with the Angular Material attributes:

The layout=”row” gives a side-by-side layout and “column” provides top-down.

In the first <div>, the “hide show-gt-md” causes this tag and it’s contents to only show on devices wider than 960px, whereas the second <div>’s “hide show-sm show-md” means it is only displayed on devices smaller than 960px (literally show-sm means show on devices smaller than 600px wide and show-md less than 960px).

I tried this simple test on a Samsung Galaxy Tab Pro 10.1″ and, as I rotated it’s orientation, it smoothly transitioned between a wide side-by-side layout in landscape and a narrow top-bottom layout in portrait.  Neat.

Howto edit top-left logo in Mean.io appserver from a custom package module

This is easy.  In the core system package’s public/views/header.html you will find the default pull-left div containing a <a> tag with a value of “MEAN”, which is displayed in the top-left of your website:

We can edit this dynamically via the “mean-token” argument using an AngularJS directive (in your custom package’s public/directives/ folder) like this:

 

Experimental Script to create a CoreOS Cluster in OpenStack

This is an experimental CoreOS cluster creator script for OpenStack Nova with Cinder: