Menu bars

Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Friday, 24 June 2016

Understanding Node+Express application flow.

As installation has explained in the last article now we want to start with the project and structure. It is very important to understand the proper directory structure of the node app since we need to map the relevant files in the right directory to align with the MVC pattern that node follows. I have found out the following article which explains the node directory structure perfectly.

Check this article

Confused over export and require ? 


I was confused too much on export, module and require stuff of nodejs until i have came across the following article which deals with the same. what i have taken from the article is that, a file is considered as a module in nodejs and if you want to use it in another file(module) then you need to export it. Simple stuff !!

Router everywhere !!


If you are start making Restful webservices we need to use routers very frequently to create different routes for our RestWebservices. They have introduced mini express in router and if you want to understand how the router works and the different functions that can be done in router like params,use,get etc.



Understanding the basic components using in the app.js


It is essential to know the components that we are using in our landing file that is app.js and their role in this particular context. So i just thought of going through each package that we are using in the app.js file.

Path - Just to know 


Path is the package  to deal with all the directory level operations to be done. __dirname gives you the current working directory and you can do many other operations like join(), basename() etc.

Error handling in Node


Error handling is very important feature every application should have. It will make the application maintainable and debuggable. The Nodejs style of error handling is little different which involves middle-wares which will make your job damn easy. check the links below.


Logging

Logging can be one of the important thing is to be done with any software application. Winston is one of the finest logger that you can use for Nodejs. Read more 

All about passing the data in Nodejs routes

Passing the data in the routes are very important to deal with the flexibility of the microservcie framework. As Node stands out as an exceptional framework to create microservices it is important to know how to pass the data.

This article talks about each and everything about passing the data between routes. 









Thursday, 23 June 2016

Nodejs installation and basics

Nodejs is getting popularity as Javascript can be used as a complete stack and JS is  the only language that you need to know before creating a web application. Yeah nothing else.

My requirements are like to install the nodejs in a unix based server, preferably centos or ubuntu. simple commands will help you to install nodejs. The following link will help you to install node perfectly to your centos system.

Please check this link 

One of the issue that i faced just after installing the nodejs was my command prompt was not understanding the node or npm as commands. What i understood is that the installation was installing node and npm to /usr/local/bin/ location. But the command line understand the binaries in the /usr/bin location. So we need to map this using synlink.

ln -s /usr/local/bin/node /usr/bin/node
ln -s /usr/local/lib/node /usr/lib/node
ln -s /usr/local/bin/npm /usr/bin/npm
ln -s /usr/local/bin/node-waf /usr/bin/node-waf

This link will help you to understand the what is going on.

Now install express with npm and the same synlinking we need to do for each package that we create.

 ln -s /usr/local/bin/express /usr/bin/express
 ln -s /usr/local/bin/node-supervisor /usr/bin/node-supervisor
 ln -s /usr/local/bin/supervisor /usr/bin/supervisor
 ln -s /usr/local/bin/n /usr/bin/n

It will be good to go through this link before we start installing new packages. This will help you understand how to install a npm package.

 n stable

it will be good if we install any daemon based package to manage our nodejs app. So it will take care of handling the nodejs instance running.

 npm install forever
 npm install forever-monitor
 ln -s /usr/local/bin/forever /usr/bin/forever

Now you can start nodejs daemon in forever as -
   forever start /tmp/node/UpgradeChecker/app/bin/www


If you want to make this as a custom service then check this link. If you do then you can start your app like,
 service nodeapp start






Python text to speach

It is a good comparison of various tools available for text to speech :

http://fossforce.com/2015/04/an-in-depth-look-at-text-to-speech-in-linux/

Setting the mbrola -- http://askubuntu.com/questions/554747/how-to-install-more-voices-to-espeak

Worth checking mary - https://sites.google.com/site/guenterbartsch/blog/maryttspythonandpulseaudio

Example python code -http://stackoverflow.com/questions/6772710/function-doesnt-work-the-second-time-its-called-in-a-thread-pyttsx-module

linux processes - https://idea.popcount.org/2012-12-11-linux-process-states/

Looking for natural sounds ? -http://askubuntu.com/questions/21811/how-can-i-install-and-use-text-to-speech-software