Wednesday, 21 January 2015

Installing NodeJS on Cloud Server and its Issues

Started this thing called NodeJs and i thought it was cool, i used it for the backend of a yet to be finished mobile-App. Cool right. i was crazy about it until i had it deployed on a borrowed cloud server(ubuntu). To Freshers lemme Explain how it is done
  STEP 1:
 Install NodeJs on the cloud server,
  apt-get install nodejs
 check version by npm -v 
STEP 2:
Transfer Code?repo Unto Cloud Server using WinSCP or other ssh third part apps
  STEP 3:
 Navigate to the folder where the nodejs code is and do a
  node filename.js 
 and what do u see? Voila ERRORS!! Intentional Apparently Ubuntu has a conflict so it uses the nodejs keyword instead of node as used on windows.

  STEP 4:
 So i tried to consume my new service on my 'borrowed ' cloud server. And it didnt work!!!! after so much happiness?This is spiritual! So i found out putty had closed connection and hence closed session to the server hence the unavailability to reach Server. So i wanted it to run forever. i searched and found this wonderful script. Wonderful,
noHup nodejs filename.js &
That worked for a while until my mochahost server decided to do a maintenance on a weekend. They did and they didnt start up my server. Crazy abi? Was i expecting them to before? So i wanted a solution. So i searched further. Got another called
Forever 
Forever does the Job perfectly, restarts your server incase of 'iranu'(errors).

 STEP 5:
 Install forever using sudo apt-get install forever --global
 DONE!!! But it doesnt recognize the NodeJs used as keyword hence it reports 'file not found' on doing a 'forever list'. So i found an alternative.
 Install node-legacy by: sudo apt-get install nodejs-legacy That fixed it. So Forever has a couple of operands: Three most important ones are : start, stop and list.
  LIST lists all the processes being run by the forever service;
Look at the circled red stuff, That is the process id;
 This can also be achieved by using the
          'ps aux| grep nodejs' 

  STOP as usual stops the process i.e
          'forever stop [process_id]', 
            equivalent to the kill -9 [ubuntuprocess_id]

  START: Starts a forever process for the nodeJs server 'forever start filename.js'

  Voila! You have Set Up That Server. !!

Tuesday, 20 January 2015

Yes I did IT

Last week i said i was gonna be writing an API, and i meant IT , Just put one up on github in a starange language called AngularJs, it is basically a Popup/menu alert with custom directives. Fun AHead just visit YES I DID.

Friday, 16 January 2015

Node JS and its attendant Interest

I dont Enjoy blogging, But for one ting in particular i get reminded of those blogs that helped me when is started this journey of self discovery. Ild start blogging today to help people too. Ild start with a grey area called NodeJs NODEJS Node Js is....... blah blah blah. i used to be a staunch hater of anything web but getting outside the four walls of the university you get to understand we are all hustlers. i am trying NodeJs for a backend job and AngularJs/HTML5 as front end and i am amazed how much the world is moving. javascript from the back? Its mindblowing, its crazy since i am an unapologetic javaist i find other technologies/ languages not me. But working over a few weeks with angular js , node js and momentjs API i notice one big thing, We have a very selfish developers ecosystem in nigeria. People contribute to API opensource to make it better, We just consume and do nothing. and so i put it to you guys, uld get my API in february, i dont know what it would be or what language but i WILL do it. enough of this yeye.