Configure UI Layer on apache2

What is Apache2 ?

Apache is the most popular web server on the internet.It is used to serve more than half of all active websites.So lets configure it for our local development.

Installing Apache2 or httpd on Ubuntu or Debian

Open Terminal and run the following commands
    $ sudo apt-get update
    $ sudo apt-get install apache2

Assuming your workspace is in /home/user/workspace/UI directory
    $ cd /var/www
    $ sudo ln -s /home/user/workspace/UI UI
The second command creates a symbolic link to your repository.

Now, we will configure our apache server to serve static contents so that 
we can run our code locally.

Configure Apache2

$ cd /etc/apache2/conf-available

Create a file fqdn.conf inside conf-available directory containing following text:
ServerName localhost

and then again create a symbolic link to fqdn.conf file
$   cd /etc/apache2/conf-enabled
$   sudo ln -s ../conf-available/fqdn.conf fqdn.conf

Add UI workspace files and ProxyPass settings to apache2 server 
Before that let us take a backup of our setting file 000-default.conf.
Backup file name is 000-default.conf.bak

$   cd /etc/apache2/sites-available
$   sudo cp 000-default.conf 000-default.conf.bak

Now modify file 000-default.conf as the following:

Change DocumentRoot to:
DocumentRoot /var/www/UI

Add the following lines towards the end of the file, just before closing </VirtualHost> tag

        ProxyRequests Off
        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPass /api http://IPAddress
        ProxyPassReverse / http://IPAddress

        <Location />
                Order allow,deny
                Allow from all
        </Location>     

After making above changes,
Enable proxy module and restart apache2 server.


    $   sudo a2enmod proxy
    $   sudo a2enmod proxy_http
    $   sudo service apache2 restart
Open up your favorite browser and type localhost
This is all about configuring UI on your local Machine for development.
The same UI can be configured and run on node server.
 


Advertisements

Parameters to measure the peformance of a web App ( Frontend Applications)

I personally thing that anyone comparing to two front end Applications built with two different stack.Performance of any app depends upon various parameters and most importantly it depends upon the Project Requirement.
As far as my experience with building application,I will try to list some of these parameters.
a) Quality of the test/benchmark code : Writing any application/module/function but writing a test case for these are comparatively more tougher.
b) Application Type : The main stack is choose on the basis of application type ,whether is data driven, small application or SPAs .The choice of framework all depends upon on requirement of the product.
c) Server load and Server performance : whether the server is able to handle multiple request .it all depends upon optimizing the server to its best .
d) Quality of Internet Connection at end user and client Side
e) Memory usage by the client Browser and type of Browser used. Resource utilization (CPU/memory/network)
f)Dom Manipulation : DOM manipulation should be very less and it is not good for performance.
g)Garbage Collection by the Browser.

In a nutshell ,no library or framework is good or bad .All we need to learn its pros and cons and best way to exploit it to get our purpose done,be in Backbone, Angular ,Ember or React.

My Experience with Angular Js

I started working on angular late 2015 and I think I have written my share of Code in Angular Js.
In the year 2015, angular and React was popular. Fast.Fast Development and less code base
for a larger application become a requirement .performance was also a factor.The last project was in Backbone and Due to its bad design we have serious issues like sync calls
and large number of HTTP calls .So we decided to move to Angular .
After going through few blogs and articles we decided to use Angular + D3 + NVD3 and
for Development and RequireJs for Dependency and Grunt for Task Manger.The best Tool
was Chrome Dev Tool which helped us throughout our development process .

As we were new to Angular and Product need to be delivered in less than 3 months (90 days ) we were little bit scared.Angular as a steep Learning Curve. The greatest pain is setting the project and once project is setup development usually becomes fast.
As I was from jquery+Backbone background, initially I find it difficult to adjust to two way data binding and few lines of code doing miracles and inbuilt directives support.Later I become fan of Angular .As the project was huge, I keep performance issues also in mind.
Performance really matters a lot as users never waits for more than 5 seconds.if you are slow you will loose the business.
My experience in building a product with Angular stack was awesome and I enjoyed it that I was able to deliver and ultra fast application with more features, custom directives.custom filters and so on.
In my application we have lots of charting libraries ,but High-charts were not supported by Angular so ,I moved to NVD3 and D3 for more user interaction.Initially due to less support I faced certain issues with NVD3 but Later I found hacks and tricks to tackle with it.

With Angular my current application become 2x times faster than previous with more efficiently managing data at front-end side.