NodeJS Series #6: Event-Driven Programming

Hi Wizards, Its been some time since I’ve left Hogwarts Magicians School for a small holiday.Now that Im back,im ready for some tricks. But before that,i’d like to talk about Event-Driven Programming and in its place in NodeJS What is Event-Driven Programming? Event-driven programming is the term where the flow of the code is determined by events(click,load,etc…) Its one of the basic milestone today’s popular programming languages such as C#,Java and many more I dont wanna fill up here. In Node.js and moreover in any kind of Javascript project,you’ll be using…

Read More

NodeJS Series #5: Installing,Uninstalling,Updating Modules

Hi Wizards, Do you remember what we did previously? We created a Port Listener which listens to a port and get response. In that post, we used a module named “http” to send request and get response. Now im gonna talk about “Modules” and how to use them. MODULES Node Package Manager consists of many modules that can be downloaded and used in your project.The list of repository can be accessed from: https://www.npmjs.com/ You can however specify if a module will be used local or global. What does that mean? Global…

Read More

NodeJS Series #4: Creating a Port Listener

Hello Wizards, First of all,sorry I couldn’t publish this post as I promised,i had illness.Even Wizards get sick! The purpose of this post is all about creating a server,listening it through a port number and then sending output to the browser. So lets start immediately! We shall write a small script that creates server and listens to this object. [sourcecode language=”javascript”] var http = require("http"); http.createServer(function (request, response) { response.writeHead(200, { "Content-Type": "text/plain" }); response.write("Listening to localhost:8888"); response.end(); }).listen(8888); [/sourcecode] Lets take a breath and talk about what this script does in…

Read More

NodeJS Series #3: Using External Files

Hello Wizards, This time we will create external .js files to call from NodeJS Command Prompt. Create a new .js file (for instance I’ve created sample.js). Add these javascript lines as an example: [sourcecode language=”javascript”] console.log("Poooff"); [/sourcecode] When we call external file from nodejs command prompt,it shall write “Pooff” as an output. Store this file to a close destination,easy to access later from command prompt.Now open “Nodejs Command Prompt” application and call this: Then press enter and see what happens.According to me,I get this one: Its that easy to call external…

Read More

NodeJS Series #2: Installing the Device and Casting a Simple Spell

Hello there Magicians, Ready to enter to the world of Node Spells? Lets install the Node.js now via http://nodejs.org Click on Install and start executable setup file. Complete the installation. Then open “Node.js” application with green icon to start casting your spells. Lets say we want to write “Poooof” on the console,heres how: [sourcecode language=”javascript”] console.log("Poooff"); [/sourcecode] Well Done Wizard! This was your first spell with Node Device and you’ve successfully did it! Next time you shall see how to install and run seperate Node spells and master at it!…

Read More

NodeJS Series #1: An Introduction to Magical Device

Hi dear readers, Its really amazing when you decide to start writing about most popular technologies and this is one of them.I’ve planned on publishing 1 article per day about this topic.It will be a real experience for you,too. NodeJS is one of the most popular “things-to-learn” nowadays. So my advice is add me to your bookmarks or simply “follow me” and read the series everyday as i’ll keep writing about it. Lets cut to the chase and speak about what NodeJS is. NodeJS? What the hell is that? Once…

Read More