Saturday, April 7, 2018

NodeJS

Basic Setup :

1. NPM
2. Node
3. MongoDB

NVM (Node Version Manager) : used for keeping multiple versions of NodeJS


NPM : Node Package Manager: a javascript package manager.

MongoDB: Document database which stores data in JSON format.
mLabs is cloud service for free sandbox  of MongoDB upto 500MB

MongoDB GUI:
Compass can be used.


To check the version of node:
node -v
mongo -v
npm -v


To Start the server for MongoDB:
mongod

Express

Express is a lightweight web application framework for Node.js, which provides us with a robust set of features for writing web apps. These features include such things as route handling, template engine integration and a middleware framework, which allows us to perform additional tasks on request and response objects.
 There is nothing you can do in Express that you couldn’t do in plain Node.js, but using Express means we don’t have to re-invent the wheel and reduces boilerplate. 

Nodemon:

nodemon is a convenience tool. It will watch the les in the directory it was started in, and if it detects any changes, it will automatically restart your Node application (meaning you don’t have to). In contrast to Express, nodemon is not something the app requires to function properly (it just aids us with development), so install it using:
npm install --save-dev nodemon



Pug is a  templating engine. Pug (formerly known as Jade)  




Angular JS - An introduction


AngularJS is a client-side MVC framework written in JavaScript. 

It runs in a web browser and greatly helps us (developers) to write modern, single-page, AJAX-style web applications.


It is a general purpose framework, but it shines when used to write CRUD (Create Read Update Delete) type web applications. 


AngularJS is a recent addition to the client-side MVC frameworks list. 

1. Dependency Injection
2. Strong focus on testability


It is Open source project by developed by Google INC. 

ng-app
ng-init
ng-model


The AngularJS team takes a very pragmatic approach to the whole family of MVC patterns, and declares that the framework is based on the MVW (model-view- whatever) 


Resources:
1. Source code : https://github.com/angular/angular.js
2. Community blog: https://blog.angularjs.org
3. Docs: https://docs.angularjs.org/tutorial
4. Code Samples: https://builtwith.angularjs.org
5. Youtube channel: https://www.youtube.com/user/angularjs

Everything you want to know about GIT

Git was created by Linus Torvalds the maker of Linux.

Bitkeeper was used by Linux system from 2002 - 2005 but Linus decided to write their own DVCS and hence the GIT was invented written in Pearl and C.

Installing Git on Windows: 
using msysgit http://msysgit.github.com

Installing on Mac
using Home Brew
   brew install git

if not using home brew, you can also download DMG package
http://git-scm.com/download/mac


To verify once git is installed, type the following command in Terminal to check the git version

git --version

Installing on Linux:
apt-get install git-core (Debian/Ubuntu)
yum install git-core (Fidora)


Git provides 3 different configuration stores:
1. System Level configuration

   git config --system
2. User level

git config --global

stored in user home directory with filename  ~/.gitconfig or c:\users\\.gitConfig

3. Repo level
   git config

stored in .git/config in each repo


Setting the Configuration

git config --global user.name
git config --global user.email
git config --global core.editor
git config --global help.autocorrect 1
git config --global color.ui auto
git config -global core.autocrlf true | false | input


git init


git status

git add

git add -u

git add -A

git commit -m 

git log

git diff

git diff Head~1















Communicating Microservices with gRPC

Interprocess communication is done by two styles;

1. REST (Representational State Transfer) : we send the resources back and forth and manipulate objects.
It is Resource focused.
Loosely coupled as get put delete methods allow to send information to the server.
Messages are text based.

2. RPC :
It is Action Focused.
Messages are birary based.

Background :
Google's internal protocol Stubby.